Skip to content

Commit 84afc4c

Browse files
authored
Merge branch 'master' into feature/icon-optional-namespace-prefix
2 parents f93f53d + 731d71a commit 84afc4c

File tree

8 files changed

+49
-65
lines changed

8 files changed

+49
-65
lines changed

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
"cakephp/cakephp": "^5.1.4"
2121
},
2222
"require-dev": {
23-
"phpunit/phpunit": "^10.5.5 || ^11.5.3 || ^12.4",
23+
"phpunit/phpunit": "^10.5.58 || ^11.5.3 || ^12.4",
2424
"cakephp/bake": "^3.0",
2525
"cakephp/cakephp-codesniffer": "^5.1"
2626
},

phpcs.xml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,9 @@
22
<ruleset name="BUI">
33
<arg value="s"/>
44

5+
<file>src/</file>
6+
<file>tests/</file>
7+
58
<rule ref="CakePHP"/>
69

710
<exclude-pattern>*/comparisons/*</exclude-pattern>

phpstan.neon

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,3 +7,5 @@ parameters:
77
ignoreErrors:
88
-
99
identifier: missingType.iterableValue
10+
-
11+
identifier: missingType.generics

src/View/Helper/BreadcrumbsHelper.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,11 @@ public function add(array|string $title, array|string|null $url = null, array $o
6363
$crumbs[] = $crumb + ['title' => '', 'url' => null, 'options' => []];
6464
}
6565

66+
/** @phpstan-ignore function.alreadyNarrowedType */
67+
if (method_exists(parent::class, 'addMany')) {
68+
return parent::addMany($crumbs);
69+
}
70+
6671
return parent::add($crumbs);
6772
}
6873

tests/TestCase/Command/CopyLayoutsCommandTest.php

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
use Cake\Console\Exception\StopException;
1010
use Cake\Console\TestSuite\ConsoleIntegrationTestTrait;
1111
use Cake\Console\TestSuite\StubConsoleOutput;
12+
use Cake\Core\Configure;
1213
use Cake\Core\Plugin;
1314
use Cake\TestSuite\TestCase;
1415
use Cake\Utility\Filesystem;
@@ -146,6 +147,11 @@ public function testHelp()
146147

147148
$this->exec('bootstrap copy_layouts --help');
148149

150+
$quiet = 'Enable quiet output';
151+
if (version_compare(Configure::version(), '5.3.0', '>=')) {
152+
$quiet .= ' and non-interactive mode';
153+
}
154+
149155
$this->assertEquals(
150156
["Copies the sample layouts into the application's layout templates
151157
folder.
@@ -156,7 +162,7 @@ public function testHelp()
156162
<info>Options:</info>
157163
158164
--help, -h Display this help.
159-
--quiet, -q Enable quiet output.
165+
--quiet, -q {$quiet}.
160166
--verbose, -v Enable verbose output.
161167
162168
<info>Arguments:</info>

tests/TestCase/Command/InstallCommandTest.php

Lines changed: 22 additions & 60 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
use Cake\Console\Exception\StopException;
1111
use Cake\Console\TestSuite\ConsoleIntegrationTestTrait;
1212
use Cake\Console\TestSuite\StubConsoleOutput;
13+
use Cake\Core\Configure;
1314
use Cake\Core\Plugin;
1415
use Cake\TestSuite\TestCase;
1516
use 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
812774
application'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(),

tests/TestCase/Command/ModifyViewCommandTest.php

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
use Cake\Console\Exception\StopException;
1010
use Cake\Console\TestSuite\ConsoleIntegrationTestTrait;
1111
use Cake\Console\TestSuite\StubConsoleOutput;
12+
use Cake\Core\Configure;
1213
use Cake\Core\Plugin;
1314
use Cake\TestSuite\TestCase;
1415

@@ -216,6 +217,11 @@ public function testHelp()
216217
{
217218
$filePath = APP . 'View' . DS . 'AppView.php';
218219

220+
$quiet = 'Enable quiet output';
221+
if (version_compare(Configure::version(), '5.3.0', '>=')) {
222+
$quiet .= ' and non-interactive mode';
223+
}
224+
219225
$this->exec('bootstrap modify_view --help');
220226

221227
$this->assertEquals(
@@ -227,7 +233,7 @@ public function testHelp()
227233
<info>Options:</info>
228234
229235
--help, -h Display this help.
230-
--quiet, -q Enable quiet output.
236+
--quiet, -q {$quiet}.
231237
--verbose, -v Enable verbose output.
232238
233239
<info>Arguments:</info>

tests/bootstrap.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,13 +39,13 @@
3939
define('WWW_ROOT', TEST_APP . 'webroot' . DS);
4040
define('CONFIG', TEST_APP . 'config' . DS);
4141

42-
//@codingStandardsIgnoreStart
42+
// phpcs:disable
4343
@mkdir(LOGS);
4444
@mkdir(SESSIONS);
4545
@mkdir(CACHE);
4646
@mkdir(CACHE . 'views');
4747
@mkdir(CACHE . 'models');
48-
//@codingStandardsIgnoreEnd
48+
// phpcs:enable
4949

5050
require_once CORE_PATH . 'config/bootstrap.php';
5151

0 commit comments

Comments
 (0)