Skip to content

Commit 8c9cfd7

Browse files
committed
chore: zenstruck/foundry-behat a subpackage (#1084)
* refactor: src/Test/Behat as a subpackage * chore(behat): make tests phpunit pass * chore(behat): make phpstan & behat tests working
1 parent ff2aaa6 commit 8c9cfd7

84 files changed

Lines changed: 1108 additions & 467 deletions

File tree

Some content is hidden

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

.gitattributes

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
/phpunit-10.xml.dist export-ignore
2020
/phpunit-paratest.xml.dist export-ignore
2121
/psalm.xml export-ignore
22+
/src/Test/Behat export-ignore
2223
/stubs export-ignore
2324
/symfony.lock export-ignore
2425
/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: 72 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -4,35 +4,31 @@ on:
44
push:
55
paths: &paths
66
- .github/workflows/behat.yml
7-
- bin/tools/behat
8-
- src/Behat/**
9-
- tests/Behat/**
10-
- behat.yml
11-
- composer.json
7+
- src/Test/Behat/**
128
pull_request:
139
paths: *paths
1410
schedule:
1511
- cron: '0 0 1,16 * *'
1612

13+
defaults:
14+
run:
15+
shell: bash
16+
working-directory: ./src/Test/Behat
17+
1718
concurrency:
1819
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
1920
cancel-in-progress: true
2021

2122
jobs:
2223
behat:
23-
name: P:${{ matrix.php }}, S:${{ matrix.symfony }}${{ matrix.deps == 'lowest' && ' (lowest)' || '' }}
24+
name: Behat - P:${{ matrix.php }}, S:${{ matrix.symfony }}${{ matrix.deps == 'lowest' && ' (lowest)' || '' }}
2425
runs-on: ubuntu-latest
2526
strategy:
2627
fail-fast: false
2728
matrix:
2829
php: [ 8.3, 8.5 ]
2930
symfony: [ 6.4.*, 7.4.* ]
3031
deps: [ highest, lowest ]
31-
env:
32-
DATABASE_URL: 'sqlite:///%kernel.project_dir%/var/data.db'
33-
USE_DAMA_DOCTRINE_TEST_BUNDLE: 1
34-
USE_PHP_84_LAZY_OBJECTS: 1
35-
MONGO_URL: ''
3632
steps:
3733
- name: Checkout code
3834
uses: actions/checkout@v3
@@ -51,16 +47,12 @@ jobs:
5147
- name: Install dependencies
5248
uses: ramsey/composer-install@v2
5349
with:
50+
working-directory: "src/Test/Behat"
5451
dependency-versions: ${{ matrix.deps }}
5552
composer-options: --prefer-dist
5653
env:
5754
SYMFONY_REQUIRE: ${{ matrix.symfony }}
5855

59-
- name: Install Behat
60-
run: composer bin behat update ${{ matrix.deps == 'lowest' && '--prefer-lowest' || '' }} --prefer-dist
61-
env:
62-
SYMFONY_REQUIRE: ${{ matrix.symfony }}
63-
6456
- name: "Main test suite: reset DB at scenario level, with Dama support"
6557
run: vendor/bin/behat --colors -vvv
6658

@@ -84,3 +76,67 @@ jobs:
8476

8577
- name: Reset DB disabled
8678
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

.github/workflows/static-analysis.yml

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -47,10 +47,8 @@ jobs:
4747
- name: Install PHPStan
4848
run: composer bin phpstan install
4949

50-
- name: Install PHPBench & Behat
51-
run: |
52-
composer bin phpbench install
53-
composer bin behat install
50+
- name: Install PHPBench
51+
run: composer bin phpbench install
5452

5553
- name: Run PHPStan
5654
run: bin/tools/phpstan/vendor/phpstan/phpstan/phpstan analyse

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: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@
2323
"symfony/polyfill-php85": "^1.33",
2424
"symfony/property-access": "^6.4|^7.0|^8.0",
2525
"symfony/property-info": "^6.4|^7.0|^8.0",
26-
"symfony/string": "^6.4|^7.0|^8.0",
2726
"symfony/var-exporter": "^6.4.9|~7.0.9|^7.1.2|^8.0",
2827
"zenstruck/assert": "^1.4"
2928
},
@@ -47,7 +46,6 @@
4746
"symfony/framework-bundle": "^6.4|^7.0|^8.0",
4847
"symfony/maker-bundle": "^1.55",
4948
"symfony/phpunit-bridge": "^6.4.26|^7.0|^8.0",
50-
"symfony/polyfill-php80": "^1.16",
5149
"symfony/routing": "^6.4|^7.0|^8.0",
5250
"symfony/runtime": "^6.4|^7.0|^8.0",
5351
"symfony/translation-contracts": "^3.4",
@@ -66,7 +64,8 @@
6664
"src/functions.php",
6765
"src/Persistence/functions.php",
6866
"src/symfony_console.php"
69-
]
67+
],
68+
"exclude-from-classmap": ["src/Test/Behat/"]
7069
},
7170
"autoload-dev": {
7271
"psr-4": {
@@ -103,9 +102,6 @@
103102
"allow-contrib": false
104103
}
105104
},
106-
"scripts": {
107-
"post-install-cmd": ["@composer bin phpstan install", "@composer bin phpbench install", "@composer bin behat install"]
108-
},
109105
"minimum-stability": "dev",
110106
"prefer-stable": true
111107
}

0 commit comments

Comments
 (0)