Add behat-version matrix dimension, fix Behat 4 type errors, unify config
CI matrix now has a behat-version dimension (stable / 4.x-dev) so both Behat 3.31 and Behat 4 are tested explicitly. Symfony 8.x rows always use Behat 4; Symfony 7.4 rows test both versions. behat.dist.php works with Behat 3.31 too (Behat\Config\Config exists as a bridge since 3.31), so drop behat.yml.dist and always use the PHP config — removes the if/else branch from CI and unifies local dev too. SessionsListener: fix type hint on prepareDefaultMinkSession from ScenarioLikeTested to ScenarioTested — the method uses getSuite() which is on LifecycleEvent (not ScenarioLikeTested), and the dispatched events are ScenarioTested subclasses. Also remove now-unused ScenarioLikeTested import. ServiceContainer/MinkExtension: add missing return types (: string, : void) to all interface method overrides to satisfy Behat 4's stricter interface signatures. Co-Authored-By: Claude Sonnet 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
22
.github/workflows/test.yaml
vendored
22
.github/workflows/test.yaml
vendored
@@ -11,7 +11,7 @@ on:
|
||||
|
||||
jobs:
|
||||
test:
|
||||
name: PHP ${{ matrix.php-version }} + Symfony ${{ matrix.symfony-version }}
|
||||
name: PHP ${{ matrix.php-version }} + Symfony ${{ matrix.symfony-version }} + Behat ${{ matrix.behat-version }}
|
||||
runs-on: ubuntu-latest
|
||||
continue-on-error: false
|
||||
strategy:
|
||||
@@ -25,11 +25,20 @@ jobs:
|
||||
- '7.4.*'
|
||||
- '8.0.*'
|
||||
- '8.1.*'
|
||||
behat-version:
|
||||
- stable
|
||||
- 4.x-dev
|
||||
exclude:
|
||||
# Symfony 8.x requires PHP >= 8.4
|
||||
- php-version: '8.3'
|
||||
symfony-version: '8.0.*'
|
||||
- php-version: '8.3'
|
||||
symfony-version: '8.1.*'
|
||||
# Behat 3.31 (stable) cannot install with Symfony 8.x
|
||||
- behat-version: stable
|
||||
symfony-version: '8.0.*'
|
||||
- behat-version: stable
|
||||
symfony-version: '8.1.*'
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
@@ -48,8 +57,8 @@ jobs:
|
||||
- name: Lock Symfony version
|
||||
run: VERSION=${{ matrix.symfony-version }} .github/workflows/lock-symfony-version.sh
|
||||
|
||||
- name: Require behat 4.x for Symfony 8+
|
||||
if: startsWith(matrix.symfony-version, '8.')
|
||||
- name: Require behat 4.x
|
||||
if: matrix.behat-version == '4.x-dev'
|
||||
run: |
|
||||
VERSION="4.x-dev as 3.31.0" .github/workflows/lock-behat-version.sh
|
||||
composer config minimum-stability dev
|
||||
@@ -62,9 +71,4 @@ jobs:
|
||||
run: vendor/bin/phpspec run -f pretty
|
||||
|
||||
- name: Behat
|
||||
run: |
|
||||
if [[ "${{ matrix.symfony-version }}" == 8.* ]]; then
|
||||
vendor/bin/behat --config behat.dist.php -fprogress --strict
|
||||
else
|
||||
vendor/bin/behat -fprogress --strict
|
||||
fi
|
||||
run: vendor/bin/behat --config behat.dist.php -fprogress --strict
|
||||
|
||||
@@ -1,11 +0,0 @@
|
||||
default:
|
||||
suites:
|
||||
default:
|
||||
path: "%paths.base%/features"
|
||||
contexts: [Behat\MinkExtension\Context\MinkContext]
|
||||
extensions:
|
||||
Behat\MinkExtension\ServiceContainer\MinkExtension:
|
||||
base_url: http://en.wikipedia.org/
|
||||
sessions:
|
||||
default:
|
||||
browserkit_http: ~
|
||||
@@ -48,7 +48,7 @@
|
||||
"scripts": {
|
||||
"test": [
|
||||
"vendor/bin/phpspec run -f pretty",
|
||||
"vendor/bin/behat -fprogress --strict"
|
||||
"vendor/bin/behat --config behat.dist.php -fprogress --strict"
|
||||
]
|
||||
}
|
||||
}
|
||||
|
||||
@@ -11,7 +11,6 @@
|
||||
namespace Behat\MinkExtension\Listener;
|
||||
|
||||
use Behat\Behat\EventDispatcher\Event\ExampleTested;
|
||||
use Behat\Behat\EventDispatcher\Event\ScenarioLikeTested;
|
||||
use Behat\Behat\EventDispatcher\Event\ScenarioTested;
|
||||
use Behat\Mink\Mink;
|
||||
use Behat\Testwork\EventDispatcher\Event\ExerciseCompleted;
|
||||
@@ -79,11 +78,11 @@ class SessionsListener implements EventSubscriberInterface
|
||||
* `@insulated` tag will cause Mink to stop current sessions before scenario
|
||||
* instead of just soft-resetting them
|
||||
*
|
||||
* @param ScenarioLikeTested $event
|
||||
* @param ScenarioTested $event
|
||||
*
|
||||
* @throws ProcessingException when the @javascript tag is used without a javascript session
|
||||
*/
|
||||
public function prepareDefaultMinkSession(ScenarioLikeTested $event)
|
||||
public function prepareDefaultMinkSession(ScenarioTested $event)
|
||||
{
|
||||
$scenario = $event->getScenario();
|
||||
$feature = $event->getFeature();
|
||||
|
||||
@@ -68,7 +68,7 @@ class MinkExtension implements ExtensionInterface
|
||||
$this->registerDriverFactory(new WebdriverClassicFactory());
|
||||
}
|
||||
|
||||
public function registerDriverFactory(DriverFactory $driverFactory)
|
||||
public function registerDriverFactory(DriverFactory $driverFactory): void
|
||||
{
|
||||
$this->driverFactories[$driverFactory->getDriverName()] = $driverFactory;
|
||||
}
|
||||
@@ -76,7 +76,7 @@ class MinkExtension implements ExtensionInterface
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function load(ContainerBuilder $container, array $config)
|
||||
public function load(ContainerBuilder $container, array $config): void
|
||||
{
|
||||
if (isset($config['mink_loader'])) {
|
||||
$basePath = $container->getParameter('paths.base');
|
||||
@@ -108,7 +108,7 @@ class MinkExtension implements ExtensionInterface
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function configure(ArrayNodeDefinition $builder)
|
||||
public function configure(ArrayNodeDefinition $builder): void
|
||||
{
|
||||
// Rewrite keys to define a shortcut way without allowing conflicts with real keys
|
||||
$renamedKeys = array_diff(
|
||||
@@ -177,7 +177,7 @@ class MinkExtension implements ExtensionInterface
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function getConfigKey()
|
||||
public function getConfigKey(): string
|
||||
{
|
||||
return 'mink';
|
||||
}
|
||||
@@ -185,14 +185,14 @@ class MinkExtension implements ExtensionInterface
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function initialize(ExtensionManager $extensionManager)
|
||||
public function initialize(ExtensionManager $extensionManager): void
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function process(ContainerBuilder $container)
|
||||
public function process(ContainerBuilder $container): void
|
||||
{
|
||||
$this->processSelectors($container);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user