Skip to content

Commit 7ce12a7

Browse files
authored
Merge pull request #390 from FriendsOfCake/cake-5
Cake 5
2 parents bd65698 + d27300d commit 7ce12a7

40 files changed

+265
-332
lines changed

.github/workflows/ci.yml

Lines changed: 9 additions & 56 deletions
Original file line numberDiff line numberDiff line change
@@ -8,75 +8,28 @@ on:
88
branches:
99
- '*'
1010

11+
permissions:
12+
contents: read
13+
1114
jobs:
1215
testsuite:
13-
runs-on: ubuntu-18.04
14-
strategy:
15-
fail-fast: false
16-
matrix:
17-
php-version: ['7.4', '8.0', '8.1']
18-
prefer-lowest: ['']
19-
include:
20-
- php-version: '7.2'
21-
prefer-lowest: 'prefer-lowest'
22-
23-
services:
24-
postgres:
25-
image: postgres
26-
ports:
27-
- 5432:5432
28-
env:
29-
POSTGRES_PASSWORD: postgres
30-
31-
steps:
32-
- uses: actions/checkout@v3
33-
34-
- name: Setup PHP
35-
uses: shivammathur/setup-php@v2
36-
with:
37-
php-version: ${{ matrix.php-version }}
38-
extensions: mbstring, intl
39-
coverage: pcov
40-
41-
- name: Composer install
42-
run: |
43-
if ${{ matrix.prefer-lowest == 'prefer-lowest' }}; then
44-
composer update --prefer-lowest --prefer-stable
45-
else
46-
composer install
47-
fi
48-
49-
- name: Setup problem matchers for PHPUnit
50-
if: matrix.php-version == '7.4'
51-
run: echo "::add-matcher::${{ runner.tool_cache }}/phpunit.json"
52-
53-
- name: Run PHPUnit
54-
run: |
55-
if [[ ${{ matrix.php-version }} == '7.4' ]]; then
56-
vendor/bin/phpunit --coverage-clover=coverage.xml
57-
else
58-
vendor/bin/phpunit
59-
fi
60-
continue-on-error: ${{ matrix.prefer-lowest == 'prefer-lowest' }}
61-
62-
- name: Code Coverage Report
63-
if: matrix.php-version == '7.4'
64-
uses: codecov/codecov-action@v3
16+
uses: cakephp/.github/.github/workflows/[email protected]
17+
secrets: inherit
6518

6619
cs-stan:
6720
name: Coding Standard & Static Analysis
68-
runs-on: ubuntu-18.04
21+
runs-on: ubuntu-22.04
6922

7023
steps:
71-
- uses: actions/checkout@v3
24+
- uses: actions/checkout@v4
7225

7326
- name: Setup PHP
7427
uses: shivammathur/setup-php@v2
7528
with:
76-
php-version: '7.4'
29+
php-version: '8.1'
7730
extensions: mbstring, intl
7831
coverage: none
79-
tools: cs2pr, vimeo/psalm:4.23, phpstan:1.7
32+
tools: cs2pr, vimeo/psalm:5, phpstan:1.10
8033

8134
- name: Composer Install
8235
run: composer install

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ vendor/
22
composer.lock
33
node_modules
44
.phpunit.result.cache
5+
.phpunit.cache
56

67
# Generated test files
78
tests/test_app/webroot/bootstrap_u_i

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,13 +15,13 @@
1515
[package]: https://packagist.org/packages/friendsofcake/bootstrap-ui
1616
[license]: LICENSE.txt
1717

18-
Transparently use [Bootstrap 5][bs] with [CakePHP 4][cakephp].
18+
Transparently use [Bootstrap 5][bs] with [CakePHP 5][cakephp].
1919

2020
For version info see [version map](https://github.com/FriendsOfCake/bootstrap-ui/wiki#version-map).
2121

2222
## Requirements
2323

24-
* CakePHP 4.x
24+
* CakePHP 5.x
2525
* Bootstrap 5.x
2626
* npm 6.x
2727
* Popper.js 2.x

composer.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,12 +17,12 @@
1717
}
1818
],
1919
"require": {
20-
"cakephp/cakephp": "^4.0"
20+
"cakephp/cakephp": "^5.0"
2121
},
2222
"require-dev": {
23-
"phpunit/phpunit": "^8.5 || ^9.3",
24-
"cakephp/bake": "^2.1",
25-
"cakephp/cakephp-codesniffer": "^4.1"
23+
"phpunit/phpunit": "^10.1",
24+
"cakephp/bake": "^3.0",
25+
"cakephp/cakephp-codesniffer": "^5.0"
2626
},
2727
"support": {
2828
"issues": "http://github.com/friendsofcake/bootstrap-ui/issues",

phpunit.xml.dist

Lines changed: 13 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,20 @@
11
<?xml version="1.0" encoding="UTF-8"?>
2-
<phpunit
3-
colors="true"
4-
stopOnFailure="false"
5-
bootstrap="./tests/bootstrap.php"
6-
>
7-
2+
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" colors="true" stopOnFailure="false" bootstrap="./tests/bootstrap.php" xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/10.2/phpunit.xsd" cacheDirectory=".phpunit.cache">
83
<testsuites>
94
<testsuite name="bootstrap">
105
<directory>tests/TestCase/</directory>
6+
<exclude>tests/TestCase/View/Helper/FormHelper/AbstractFormHelperTest.php</exclude>
117
</testsuite>
128
</testsuites>
13-
14-
<listeners>
15-
<listener class="Cake\TestSuite\Fixture\FixtureInjector">
16-
<arguments>
17-
<object class="\Cake\TestSuite\Fixture\FixtureManager"/>
18-
</arguments>
19-
</listener>
20-
</listeners>
21-
22-
<filter>
23-
<whitelist>
24-
<directory suffix=".php">./src/</directory>
25-
</whitelist>
26-
</filter>
9+
<extensions>
10+
<bootstrap class="Cake\TestSuite\Fixture\Extension\PHPUnitExtension"/>
11+
</extensions>
12+
<php>
13+
<env name="FIXTURE_SCHEMA_METADATA" value="./tests/schema.php"/>
14+
</php>
15+
<source>
16+
<include>
17+
<directory suffix=".php">src/</directory>
18+
</include>
19+
</source>
2720
</phpunit>

psalm.xml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@
66
xmlns="https://getpsalm.org/schema/config"
77
xsi:schemaLocation="https://getpsalm.org/schema/config vendor/vimeo/psalm/config.xsd"
88
autoloader="tests/bootstrap.php"
9+
findUnusedBaselineEntry="false"
10+
findUnusedCode="false"
911
>
1012
<projectFiles>
1113
<directory name="src" />

src/Plugin.php renamed to src/BootstrapUIPlugin.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,28 +10,28 @@
1010
use Cake\Console\CommandCollection;
1111
use Cake\Core\BasePlugin;
1212

13-
class Plugin extends BasePlugin
13+
class BootstrapUIPlugin extends BasePlugin
1414
{
1515
/**
1616
* Plugin name.
1717
*
18-
* @var string
18+
* @var string|null
1919
*/
20-
protected $name = 'BootstrapUI';
20+
protected ?string $name = 'BootstrapUI';
2121

2222
/**
2323
* Do bootstrapping or not
2424
*
2525
* @var bool
2626
*/
27-
protected $bootstrapEnabled = false;
27+
protected bool $bootstrapEnabled = false;
2828

2929
/**
3030
* Load routes or not
3131
*
3232
* @var bool
3333
*/
34-
protected $routesEnabled = false;
34+
protected bool $routesEnabled = false;
3535

3636
/**
3737
* @inheritDoc

src/Command/BootstrapCommand.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ class BootstrapCommand extends Command implements CommandCollectionAwareInterfac
2121
*
2222
* @var \Cake\Console\CommandCollection
2323
*/
24-
protected $commands;
24+
protected CommandCollection $commands;
2525

2626
/**
2727
* @inheritDoc
@@ -34,7 +34,7 @@ public function setCommandCollection(CommandCollection $commands): void
3434
/**
3535
* @inheritDoc
3636
*/
37-
public function execute(Arguments $args, ConsoleIo $io)
37+
public function execute(Arguments $args, ConsoleIo $io): ?int
3838
{
3939
$io->warning('No command provided. Run `bootstrap --help` to get a list of commands.');
4040

src/Command/CopyLayoutsCommand.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
use Cake\Console\ConsoleIo;
99
use Cake\Console\ConsoleOptionParser;
1010
use Cake\Core\Plugin;
11-
use Cake\Filesystem\Filesystem;
11+
use Cake\Utility\Filesystem;
1212

1313
/**
1414
* Copies the sample layouts into the application's layout templates folder.
@@ -18,7 +18,7 @@ class CopyLayoutsCommand extends Command
1818
/**
1919
* @inheritDoc
2020
*/
21-
public function execute(Arguments $args, ConsoleIo $io)
21+
public function execute(Arguments $args, ConsoleIo $io): ?int
2222
{
2323
$io->info('Copying sample layouts...');
2424

src/Command/InstallCommand.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
use Cake\Console\ConsoleIo;
1111
use Cake\Console\ConsoleOptionParser;
1212
use Cake\Core\Plugin;
13-
use Cake\Filesystem\Filesystem;
13+
use Cake\Utility\Filesystem;
1414

1515
/**
1616
* Installs Bootstrap dependencies and links the assets to the application's webroot.
@@ -20,7 +20,7 @@ class InstallCommand extends Command
2020
/**
2121
* @inheritDoc
2222
*/
23-
public function execute(Arguments $args, ConsoleIo $io)
23+
public function execute(Arguments $args, ConsoleIo $io): ?int
2424
{
2525
$this->installPackages($args, $io);
2626
$this->refreshAssetBuffer($io);
@@ -250,7 +250,7 @@ protected function _deleteBufferedPackageAssets(ConsoleIo $io): bool
250250
/**
251251
* Finds the buffered package assets.
252252
*
253-
* @return \SplFileInfo[]
253+
* @return array<\SplFileInfo>
254254
*/
255255
protected function _findBufferedPackageAssets(): array
256256
{
@@ -344,7 +344,7 @@ protected function _bufferPackageAssets(ConsoleIo $io): bool
344344
/**
345345
* Finds the package assets to buffer.
346346
*
347-
* @return \SplFileInfo[]
347+
* @return array<\SplFileInfo>
348348
*/
349349
protected function _findPackageAssets(): array
350350
{

0 commit comments

Comments
 (0)