@@ -53,6 +53,58 @@ public function testDownload() {
5353 $ this ->assertDirectoryNotExists (Base::INSTALLATION_FOLDER . '/site ' );
5454 }
5555
56+ public function testDownloadWithRelativeSrc () {
57+ $ this ->checkInstallation ();
58+ $ relativePath = basename (Base::INSTALLATION_ARCHIVE ); // e.g., 'archive.zip'
59+ if (!file_exists ($ relativePath )) {
60+ copy (Base::INSTALLATION_ARCHIVE , $ relativePath );
61+ }
62+ // Ensure the ProcessWire directory exists for the test
63+ if (!is_dir (Base::INSTALLATION_FOLDER )) {
64+ mkdir (Base::INSTALLATION_FOLDER );
65+ }
66+ $ options = array ('--no-install ' => true , '--src ' => $ relativePath );
67+ $ this ->tester ->execute (array_merge ($ this ->defaults , $ options ));
68+ $ this ->assertDirectoryExists (Base::INSTALLATION_FOLDER );
69+ if (file_exists ($ relativePath )) {
70+ unlink ($ relativePath );
71+ }
72+ }
73+
74+ public function testDownloadWithAbsoluteSrc () {
75+ $ this ->checkInstallation ();
76+ $ absolutePath = realpath (Base::INSTALLATION_ARCHIVE );
77+ // Ensure the ProcessWire directory exists for the test
78+ if (!is_dir (Base::INSTALLATION_FOLDER )) {
79+ mkdir (Base::INSTALLATION_FOLDER );
80+ }
81+ $ options = array ('--no-install ' => true , '--src ' => $ absolutePath );
82+ $ this ->tester ->execute (array_merge ($ this ->defaults , $ options ));
83+ $ this ->assertDirectoryExists (Base::INSTALLATION_FOLDER );
84+ }
85+
86+ public function testDownloadWithNonExistentSrc () {
87+ $ this ->checkInstallation ();
88+ $ options = array ('--no-install ' => true , '--src ' => 'nonexistent.zip ' );
89+ $ this ->expectException (\RuntimeException::class);
90+ $ this ->tester ->execute (array_merge ($ this ->defaults , $ options ));
91+ }
92+
93+ public function testDownloadWithMixedSlashesAndSpacesSrc () {
94+ $ this ->checkInstallation ();
95+ $ absolutePath = realpath (Base::INSTALLATION_ARCHIVE );
96+ // Simulate a path with mixed slashes and spaces
97+ $ mixedPath = str_replace ('/ ' , '\\' , $ absolutePath );
98+ $ mixedPath = ' ' . $ mixedPath . ' ' ;
99+ // Ensure the ProcessWire directory exists for the test
100+ if (!is_dir (Base::INSTALLATION_FOLDER )) {
101+ mkdir (Base::INSTALLATION_FOLDER );
102+ }
103+ $ options = array ('--no-install ' => true , '--src ' => $ mixedPath );
104+ $ this ->tester ->execute (array_merge ($ this ->defaults , $ options ));
105+ $ this ->assertDirectoryExists (Base::INSTALLATION_FOLDER );
106+ }
107+
56108 /**
57109 * @depends testDownload
58110 * @expectedException RuntimeException
0 commit comments