Skip to content

Commit 2f455f8

Browse files
authored
Merge pull request #69 from ADmad/cake-5
Cake 5
2 parents 4208305 + 4a31ec8 commit 2f455f8

25 files changed

+97
-205
lines changed

.gitattributes

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,9 @@
33
.gitattributes export-ignore
44
.gitignore export-ignore
55
phpunit.xml.dist export-ignore
6-
.travis.yml export-ignore
76
tests export-ignore
87
phpstan.neon export-ignore
98
psalm.xml export-ignore
109
psalm-baseline.xml export-ignore
1110
.github export-ignore
11+
phpstan.neon export-ignore

.github/workflows/ci.yml

Lines changed: 7 additions & 86 deletions
Original file line numberDiff line numberDiff line change
@@ -8,93 +8,14 @@ on:
88
branches:
99
- '*'
1010

11+
permissions:
12+
contents: read
13+
1114
jobs:
1215
testsuite:
13-
runs-on: ubuntu-20.04
14-
strategy:
15-
fail-fast: false
16-
matrix:
17-
php-version: ['7.4', '8.0', '8.1']
18-
db-type: [mysql, pgsql]
19-
prefer-lowest: ['']
20-
include:
21-
- php-version: '7.2'
22-
db-type: 'sqlite'
23-
prefer-lowest: 'prefer-lowest'
24-
25-
services:
26-
postgres:
27-
image: postgres
28-
ports:
29-
- 5432:5432
30-
env:
31-
POSTGRES_PASSWORD: postgres
32-
33-
steps:
34-
- uses: actions/checkout@v3
35-
36-
- name: Setup Service
37-
if: matrix.db-type == 'mysql'
38-
run: |
39-
sudo service mysql start
40-
mysql -h 127.0.0.1 -u root -proot -e 'CREATE DATABASE cakephp;'
41-
42-
- name: Setup PHP
43-
uses: shivammathur/setup-php@v2
44-
with:
45-
php-version: ${{ matrix.php-version }}
46-
extensions: mbstring, intl, pdo_${{ matrix.db-type }}
47-
coverage: pcov
48-
49-
- name: Composer install
50-
run: |
51-
if ${{ matrix.prefer-lowest == 'prefer-lowest' }}; then
52-
composer update --prefer-lowest --prefer-stable
53-
else
54-
composer install
55-
fi
56-
57-
- name: Run PHPUnit
58-
run: |
59-
if [[ ${{ matrix.db-type }} == 'sqlite' ]]; then export DB_URL='sqlite:///:memory:'; fi
60-
if [[ ${{ matrix.db-type }} == 'mysql' ]]; then export DB_URL='mysql://root:[email protected]/cakephp'; fi
61-
if [[ ${{ matrix.db-type }} == 'pgsql' ]]; then export DB_URL='postgres://postgres:[email protected]/postgres'; fi
62-
63-
if [[ ${{ matrix.php-version }} == '7.2' && ${{ matrix.db-type }} == 'mysql' ]]; then
64-
vendor/bin/phpunit --coverage-clover=coverage.xml --verbose
65-
else
66-
vendor/bin/phpunit
67-
fi
68-
69-
- name: Code Coverage Report
70-
if: success() && matrix.php-version == '7.4' && matrix.db-type == 'mysql'
71-
uses: codecov/codecov-action@v3
16+
uses: ADmad/.github/.github/workflows/testsuite-with-db.yml@master
17+
secrets: inherit
7218

7319
cs-stan:
74-
name: Coding Standard & Static Analysis
75-
runs-on: ubuntu-20.04
76-
77-
steps:
78-
- uses: actions/checkout@v3
79-
80-
- name: Setup PHP
81-
uses: shivammathur/setup-php@v2
82-
with:
83-
php-version: '7.4'
84-
extensions: mbstring, intl
85-
coverage: none
86-
tools: vimeo/psalm:4, phpstan:1, cs2pr
87-
88-
- name: Composer Install
89-
run: composer require cakephp/cakephp-codesniffer:^4.2
90-
91-
- name: Run phpcs
92-
run: vendor/bin/phpcs --report=checkstyle --standard=CakePHP src/ tests/ | cs2pr
93-
94-
- name: Run psalm
95-
if: always()
96-
run: psalm --output-format=github
97-
98-
- name: Run phpstan
99-
if: always()
100-
run: phpstan analyse
20+
uses: ADmad/.github/.github/workflows/cs-stan.yml@master
21+
secrets: inherit

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
/composer.lock
22
/vendor
3+
.phpunit.cache
34
.phpunit.result.cache

composer.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,10 +23,10 @@
2323
"issues":"https://github.com/ADmad/cakephp-i18n/issues"
2424
},
2525
"require": {
26-
"cakephp/cakephp": "^4.0.2"
26+
"cakephp/cakephp": "^5.0"
2727
},
2828
"require-dev": {
29-
"phpunit/phpunit": "~8.5.0"
29+
"phpunit/phpunit": "^10.1"
3030
},
3131
"autoload": {
3232
"psr-4": {

phpstan.neon

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
parameters:
2-
level: 6
2+
level: 7
33
checkMissingIterableValueType: false
44
checkGenericClassInNonGenericObjectType: false
55
treatPhpDocTypesAsCertain: false

phpunit.xml.dist

Lines changed: 12 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -1,36 +1,19 @@
11
<?xml version="1.0" encoding="UTF-8"?>
2-
<phpunit
3-
colors="true"
4-
processIsolation="false"
5-
stopOnFailure="false"
6-
bootstrap="./tests/bootstrap.php"
7-
>
8-
<php>
9-
<ini name="memory_limit" value="-1"/>
10-
</php>
11-
12-
<!-- Add any additional test suites you want to run here -->
2+
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" colors="true" processIsolation="false" stopOnFailure="false" bootstrap="./tests/bootstrap.php" xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/10.2/phpunit.xsd" cacheDirectory=".phpunit.cache">
133
<testsuites>
144
<testsuite name="ADmad/I18n TestSuite">
155
<directory>./tests/TestCase</directory>
166
</testsuite>
17-
<!-- Add plugin test suites here. -->
187
</testsuites>
19-
20-
<!-- Setup a listener for fixtures -->
21-
<listeners>
22-
<listener
23-
class="\Cake\TestSuite\Fixture\FixtureInjector"
24-
file="./vendor/cakephp/cakephp/src/TestSuite/Fixture/FixtureInjector.php">
25-
<arguments>
26-
<object class="\Cake\TestSuite\Fixture\FixtureManager" />
27-
</arguments>
28-
</listener>
29-
</listeners>
30-
31-
<filter>
32-
<whitelist>
33-
<directory suffix=".php">./src/</directory>
34-
</whitelist>
35-
</filter>
8+
<extensions>
9+
<bootstrap class="Cake\TestSuite\Fixture\Extension\PHPUnitExtension"/>
10+
</extensions>
11+
<php>
12+
<env name="FIXTURE_SCHEMA_METADATA" value="./tests/schema.php"/>
13+
</php>
14+
<source>
15+
<include>
16+
<directory suffix=".php">src/</directory>
17+
</include>
18+
</source>
3619
</phpunit>

psalm.xml

Lines changed: 3 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="true"
10+
findUnusedCode="false"
911
>
1012
<projectFiles>
1113
<directory name="src" />
@@ -16,5 +18,6 @@
1618

1719
<issueHandlers>
1820
<PropertyNotSetInConstructor errorLevel="info" />
21+
<MissingConstructor errorLevel="info" />
1922
</issueHandlers>
2023
</psalm>

src/Command/I18nCommand.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ class I18nCommand extends Command
1818
*
1919
* @var string
2020
*/
21-
protected $name = 'admad/i18n';
21+
protected string $name = 'admad/i18n';
2222

2323
/**
2424
* Get the command name.

src/Command/I18nExtractCommand.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,14 +30,14 @@ class I18nExtractCommand extends CakeI18nExtractCommand
3030
*
3131
* @var array
3232
*/
33-
protected $_languages = [];
33+
protected array $_languages = [];
3434

3535
/**
3636
* The name of this command.
3737
*
3838
* @var string
3939
*/
40-
protected $name = 'admad/i18n extract';
40+
protected string $name = 'admad/i18n extract';
4141

4242
/**
4343
* Get the command name.

src/Command/I18nInitCommand.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ class I18nInitCommand extends CakeI18nInitCommand
2525
*
2626
* @var string
2727
*/
28-
protected $name = 'admad/i18n init';
28+
protected string $name = 'admad/i18n init';
2929

3030
/**
3131
* @inheritDoc

0 commit comments

Comments
 (0)