Skip to content

Commit f5b20d7

Browse files
committed
chore(behat): make phpstan & behat tests working
1 parent 54545ef commit f5b20d7

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

51 files changed

+724
-445
lines changed

.gitattributes

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
/phpunit-10.xml.dist export-ignore
2020
/phpunit-paratest.xml.dist export-ignore
2121
/psalm.xml export-ignore
22-
/src/Behat export-ignore
22+
/src/Test/Behat export-ignore
2323
/stubs export-ignore
2424
/symfony.lock export-ignore
2525
/tests export-ignore

.github/workflows/bc-check.yml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -22,16 +22,16 @@ jobs:
2222
with:
2323
fetch-depth: 0
2424

25-
- name: Install dependencies
26-
uses: ramsey/composer-install@v2
27-
with:
28-
composer-options: --prefer-dist
29-
3025
- name: Install PHP with extensions.
3126
uses: shivammathur/setup-php@v2
3227
with:
3328
php-version: "8.5"
3429

30+
- name: Install dependencies
31+
uses: ramsey/composer-install@v2
32+
with:
33+
composer-options: --prefer-dist
34+
3535
- name: Install roave/backward-compatibility-check.
3636
run: composer bin bc-check require roave/backward-compatibility-check
3737

.github/workflows/behat.yml

Lines changed: 65 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -21,19 +21,14 @@ concurrency:
2121

2222
jobs:
2323
behat:
24-
name: P:${{ matrix.php }}, S:${{ matrix.symfony }}${{ matrix.deps == 'lowest' && ' (lowest)' || '' }}
24+
name: Behat - P:${{ matrix.php }}, S:${{ matrix.symfony }}${{ matrix.deps == 'lowest' && ' (lowest)' || '' }}
2525
runs-on: ubuntu-latest
2626
strategy:
2727
fail-fast: false
2828
matrix:
2929
php: [ 8.3, 8.5 ]
3030
symfony: [ 6.4.*, 7.4.* ]
3131
deps: [ highest, lowest ]
32-
env:
33-
DATABASE_URL: 'sqlite:///%kernel.project_dir%/var/data.db'
34-
USE_DAMA_DOCTRINE_TEST_BUNDLE: 1
35-
USE_PHP_84_LAZY_OBJECTS: 1
36-
MONGO_URL: ''
3732
steps:
3833
- name: Checkout code
3934
uses: actions/checkout@v3
@@ -81,3 +76,67 @@ jobs:
8176

8277
- name: Reset DB disabled
8378
run: vendor/bin/behat --colors -vvv --profile=reset-disabled
79+
80+
phpunit:
81+
name: PHPUnit - P:${{ matrix.php }}, S:${{ matrix.symfony }}${{ matrix.deps == 'lowest' && ' (lowest)' || '' }}
82+
runs-on: ubuntu-latest
83+
strategy:
84+
fail-fast: false
85+
matrix:
86+
php: [ 8.3, 8.5 ]
87+
symfony: [ 6.4.*, 7.4.* ]
88+
deps: [ highest, lowest ]
89+
steps:
90+
- name: Checkout code
91+
uses: actions/checkout@v3
92+
93+
- name: Setup PHP
94+
uses: shivammathur/setup-php@v2
95+
with:
96+
php-version: ${{ matrix.php }}
97+
coverage: none
98+
tools: flex
99+
100+
- name: Add the polyfill compatible with Doctrine ^2.16
101+
if: ${{ matrix.deps == 'lowest' }}
102+
run: composer require --dev symfony/polyfill-php80:^1.16 --no-update
103+
104+
- name: Install dependencies
105+
uses: ramsey/composer-install@v2
106+
with:
107+
working-directory: "src/Test/Behat"
108+
dependency-versions: ${{ matrix.deps }}
109+
composer-options: --prefer-dist
110+
env:
111+
SYMFONY_REQUIRE: ${{ matrix.symfony }}
112+
113+
- name: Run tests
114+
run: vendor/bin/phpunit
115+
116+
phpstan:
117+
name: PhpStan
118+
runs-on: ubuntu-latest
119+
steps:
120+
- name: Checkout code
121+
uses: actions/checkout@v3
122+
123+
- name: Setup PHP
124+
uses: shivammathur/setup-php@v2
125+
with:
126+
php-version: 8.5
127+
coverage: none
128+
tools: flex
129+
130+
- name: Install dependencies
131+
uses: ramsey/composer-install@v2
132+
with:
133+
working-directory: "src/Test/Behat"
134+
composer-options: --prefer-dist
135+
env:
136+
SYMFONY_REQUIRE: 7.4.*
137+
138+
- name: Install PHPStan
139+
run: composer bin phpstan install
140+
141+
- name: Run PHPStan
142+
run: ../../../bin/tools/phpstan/vendor/phpstan/phpstan/phpstan

bin/console

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,6 @@ use Zenstruck\Foundry\Tests\Fixture\TestKernel;
66

77
require_once __DIR__ . '/../tests/bootstrap.php';
88

9-
foreach ($argv ?? [] as $i => $arg) {
10-
if (($arg === '--env' || $arg === '-e') && isset($argv[$i + 1])) {
11-
$_ENV['APP_ENV'] = $argv[$i + 1];
12-
break;
13-
}
14-
}
15-
16-
$application = new Application(new TestKernel($_ENV['APP_ENV'], true));
9+
$application = new Application(new TestKernel('test', true));
1710

1811
$application->run();

bin/tools/behat/.gitignore

Lines changed: 0 additions & 1 deletion
This file was deleted.

bin/tools/behat/composer.json

Lines changed: 0 additions & 17 deletions
This file was deleted.

bin/tools/behat/symfony.lock

Lines changed: 0 additions & 49 deletions
This file was deleted.

composer.json

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -102,9 +102,6 @@
102102
"allow-contrib": false
103103
}
104104
},
105-
"scripts": {
106-
"post-install-cmd": ["@composer bin phpstan install", "@composer bin phpbench install", "@composer bin behat install"]
107-
},
108105
"minimum-stability": "dev",
109106
"prefer-stable": true
110107
}

0 commit comments

Comments
 (0)