1010use Cake \Console \Exception \StopException ;
1111use Cake \Console \TestSuite \ConsoleIntegrationTestTrait ;
1212use Cake \Console \TestSuite \StubConsoleOutput ;
13+ use Cake \Core \Configure ;
1314use Cake \Core \Plugin ;
1415use Cake \TestSuite \TestCase ;
1516use Cake \Utility \Filesystem ;
@@ -26,9 +27,7 @@ public function testInstall()
2627 $ appWebrootPluginPath = WWW_ROOT . 'bootstrap_u_i ' . DS ;
2728
2829 $ filesystem = new Filesystem ();
29- $ filesystem ->deleteDir ($ appWebrootPath );
30-
31- $ this ->assertDirectoryDoesNotExist ($ appWebrootPath );
30+ $ filesystem ->mkdir ($ appWebrootPath );
3231
3332 $ this ->exec ('bootstrap install ' );
3433
@@ -89,10 +88,6 @@ public function testInstall()
8988 '<success>`bootstrap.bundle.js.map` successfully deleted.</success> ' ,
9089 '<success>`bootstrap.bundle.min.js` successfully deleted.</success> ' ,
9190 '<success>`bootstrap.bundle.min.js.map` successfully deleted.</success> ' ,
92- '<success>`popper.js` successfully deleted.</success> ' ,
93- '<success>`popper.js.map` successfully deleted.</success> ' ,
94- '<success>`popper.min.js` successfully deleted.</success> ' ,
95- '<success>`popper.min.js.map` successfully deleted.</success> ' ,
9691 '<success>`bootstrap-icons.css` successfully deleted.</success> ' ,
9792 '<success>`bootstrap-icons.woff` successfully deleted.</success> ' ,
9893 '<success>`bootstrap-icons.woff2` successfully deleted.</success> ' ,
@@ -106,10 +101,6 @@ public function testInstall()
106101 '<success>`bootstrap.bundle.js.map` successfully copied.</success> ' ,
107102 '<success>`bootstrap.bundle.min.js` successfully copied.</success> ' ,
108103 '<success>`bootstrap.bundle.min.js.map` successfully copied.</success> ' ,
109- '<success>`popper.js` successfully copied.</success> ' ,
110- '<success>`popper.js.map` successfully copied.</success> ' ,
111- '<success>`popper.min.js` successfully copied.</success> ' ,
112- '<success>`popper.min.js.map` successfully copied.</success> ' ,
113104 '<success>`bootstrap-icons.css` successfully copied.</success> ' ,
114105 '<success>`bootstrap-icons.woff` successfully copied.</success> ' ,
115106 '<success>`bootstrap-icons.woff2` successfully copied.</success> ' ,
@@ -131,10 +122,6 @@ public function testInstall()
131122 '<success>`bootstrap.bundle.js.map` successfully deleted.</success> ' ,
132123 '<success>`bootstrap.bundle.min.js` successfully deleted.</success> ' ,
133124 '<success>`bootstrap.bundle.min.js.map` successfully deleted.</success> ' ,
134- '<success>`popper.js` successfully deleted.</success> ' ,
135- '<success>`popper.js.map` successfully deleted.</success> ' ,
136- '<success>`popper.min.js` successfully deleted.</success> ' ,
137- '<success>`popper.min.js.map` successfully deleted.</success> ' ,
138125 '<success>`bootstrap-icons.css` successfully deleted.</success> ' ,
139126 '<success>`bootstrap-icons.woff` successfully deleted.</success> ' ,
140127 '<success>`bootstrap-icons.woff2` successfully deleted.</success> ' ,
@@ -146,13 +133,10 @@ public function testInstall()
146133 '<success>`bootstrap.bundle.js.map` successfully copied.</success> ' ,
147134 '<success>`bootstrap.bundle.min.js` successfully copied.</success> ' ,
148135 '<success>`bootstrap.bundle.min.js.map` successfully copied.</success> ' ,
149- '<success>`popper.js` successfully copied.</success> ' ,
150- '<success>`popper.js.map` successfully copied.</success> ' ,
151- '<success>`popper.min.js` successfully copied.</success> ' ,
152- '<success>`popper.min.js.map` successfully copied.</success> ' ,
153136 '<success>`bootstrap-icons.css` successfully copied.</success> ' ,
154137 '<success>`bootstrap-icons.woff` successfully copied.</success> ' ,
155138 '<success>`bootstrap-icons.woff2` successfully copied.</success> ' ,
139+ "Copied assets to directory $ appWebrootPluginPath " ,
156140 ];
157141 $ this ->assertEquals ($ notPresentInNonVerboseMode , array_values (array_diff ($ expected , $ this ->_out ->messages ())));
158142 $ this ->assertExitCode (Command::CODE_SUCCESS );
@@ -164,7 +148,9 @@ public function testReInstall()
164148 $ appWebrootPath = WWW_ROOT ;
165149 $ appWebrootPluginPath = WWW_ROOT . 'bootstrap_u_i ' . DS ;
166150
167- $ this ->assertDirectoryExists ($ appWebrootPath );
151+ $ filesystem = new Filesystem ();
152+ $ filesystem ->mkdir ($ appWebrootPath );
153+
168154 $ this ->assertDirectoryExists ($ appWebrootPluginPath . 'css ' );
169155 $ this ->assertDirectoryExists ($ appWebrootPluginPath . 'js ' );
170156
@@ -244,45 +230,16 @@ public function testInstallVerbose()
244230 {
245231 $ this ->exec ('bootstrap install -v ' );
246232
247- $ appWebrootPluginPath = WWW_ROOT . 'bootstrap_u_i ' ;
248- $ expected = [
249- '<info>Clearing `node_modules` folder (this can take a while)...</info> ' ,
250- '<success>Cleared `node_modules` folder.</success> ' ,
251- '<info>Installing packages...</info> ' ,
252- '<success>`bootstrap.css` successfully deleted.</success> ' ,
253- '<success>`bootstrap.css.map` successfully deleted.</success> ' ,
254- '<success>`bootstrap.min.css` successfully deleted.</success> ' ,
255- '<success>`bootstrap.min.css.map` successfully deleted.</success> ' ,
256- '<success>`bootstrap.bundle.js` successfully deleted.</success> ' ,
257- '<success>`bootstrap.bundle.js.map` successfully deleted.</success> ' ,
258- '<success>`bootstrap.bundle.min.js` successfully deleted.</success> ' ,
259- '<success>`bootstrap.bundle.min.js.map` successfully deleted.</success> ' ,
260- '<success>`bootstrap-icons.css` successfully deleted.</success> ' ,
261- '<success>`bootstrap-icons.woff` successfully deleted.</success> ' ,
262- '<success>`bootstrap-icons.woff2` successfully deleted.</success> ' ,
263- '<success>All buffered files cleared.</success> ' ,
264- '<info>Installing packages...</info> ' ,
265- '<success>`bootstrap.css` successfully copied.</success> ' ,
266- '<success>`bootstrap.css.map` successfully copied.</success> ' ,
267- '<success>`bootstrap.min.css` successfully copied.</success> ' ,
268- '<success>`bootstrap.min.css.map` successfully copied.</success> ' ,
269- '<success>`bootstrap.bundle.js` successfully copied.</success> ' ,
270- '<success>`bootstrap.bundle.js.map` successfully copied.</success> ' ,
271- '<success>`bootstrap.bundle.min.js` successfully copied.</success> ' ,
272- '<success>`bootstrap.bundle.min.js.map` successfully copied.</success> ' ,
273- '<success>`bootstrap-icons.css` successfully copied.</success> ' ,
274- '<success>`bootstrap-icons.woff` successfully copied.</success> ' ,
275- '<success>`bootstrap-icons.woff2` successfully copied.</success> ' ,
276- '<success>All files buffered.</success> ' ,
277- '<info>Removing possibly existing plugin assets...</info> ' ,
278- 'For plugin: BootstrapUI ' ,
279- '<info>Linking plugin assets...</info> ' ,
280- 'For plugin: BootstrapUI ' ,
281- "Copied assets to directory $ appWebrootPluginPath " ,
282- 'Done ' ,
283- '<success>Installation completed.</success> ' ,
284- ];
285- $ this ->assertEmpty (array_diff ($ expected , $ this ->_out ->messages ()));
233+ // Verify key messages are present (exact file list varies by bootstrap version)
234+ $ messages = $ this ->_out ->messages ();
235+ $ this ->assertContains ('<info>Clearing `node_modules` folder (this can take a while)...</info> ' , $ messages );
236+ $ this ->assertContains ('<success>Cleared `node_modules` folder.</success> ' , $ messages );
237+ $ this ->assertContains ('<info>Installing packages...</info> ' , $ messages );
238+ $ this ->assertContains ('<success>All buffered files cleared.</success> ' , $ messages );
239+ $ this ->assertContains ('<success>All files buffered.</success> ' , $ messages );
240+ $ this ->assertContains ('<info>Removing possibly existing plugin assets...</info> ' , $ messages );
241+ $ this ->assertContains ('<info>Linking plugin assets...</info> ' , $ messages );
242+ $ this ->assertContains ('<success>Installation completed.</success> ' , $ messages );
286243 $ this ->assertExitCode (Command::CODE_SUCCESS );
287244
288245 $ filesystem = new Filesystem ();
@@ -807,6 +764,11 @@ public function testHelp()
807764 {
808765 $ this ->exec ('bootstrap install --help ' );
809766
767+ $ quiet = 'Enable quiet output ' ;
768+ if (version_compare (Configure::version (), '5.3.0 ' , '>= ' )) {
769+ $ quiet .= ' and non-interactive mode ' ;
770+ }
771+
810772 $ this ->assertEquals (
811773 ["Installs Bootstrap dependencies and links the assets to the
812774application's webroot.
@@ -818,7 +780,7 @@ public function testHelp()
818780
819781--help, -h Display this help.
820782--latest, -l To install the latest minor versions of required assets.
821- --quiet, -q Enable quiet output .
783+ --quiet, -q { $ quiet} .
822784--verbose, -v Enable verbose output.
823785 " ],
824786 $ this ->_out ->messages (),
0 commit comments