Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
50 changes: 37 additions & 13 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,7 @@ jobs:
strategy:
matrix:
php: [8.2, 8.3, 8.4]
symfony: ["5.4.*", "6.4.*", "7.2.*"]
exclude:
- php: 8.1
symfony: "7.2.*"
symfony: ["5.4.*", "6.4.*", "6.4wApi", "7.2.*"]

steps:
- name: Checkout code
Expand All @@ -25,11 +22,26 @@ jobs:
coverage: none

- name: Set Symfony version reference
run: echo "SF_REF=${MATRIX_SYMFONY%.*}" >> $GITHUB_ENV
env:
MATRIX_SYMFONY: ${{ matrix.symfony }}
run: |
if [[ "$MATRIX_SYMFONY" == *'*' ]]; then
echo "SF_REF=${MATRIX_SYMFONY%.*}" >> "$GITHUB_ENV"
else
echo "SF_REF=$MATRIX_SYMFONY" >> "$GITHUB_ENV"
fi

- name: Set Composer Symfony constraint
env:
MATRIX_SYMFONY: ${{ matrix.symfony }}
run: |
if [[ "$MATRIX_SYMFONY" == "6.4wApi" ]]; then
echo "COMP_SYMFONY=6.4.*" >> "$GITHUB_ENV"
else
echo "COMP_SYMFONY=$MATRIX_SYMFONY" >> "$GITHUB_ENV"
fi

- name: Checkout Symfony ${{ env.SF_REF }} Sample
- name: Checkout Symfony ${{ env.SF_REF }} sample
uses: actions/checkout@v4
with:
repository: Codeception/symfony-module-tests
Expand All @@ -51,17 +63,24 @@ jobs:
run: composer require --dev --no-update "phpunit/phpunit=^10.0"

- name: Install dependencies
env:
MATRIX_SYMFONY: ${{ matrix.symfony }}
run: |
composer require symfony/finder=${{ matrix.symfony }} --no-update
composer require symfony/yaml=${{ matrix.symfony }} --no-update
composer require symfony/console=${{ matrix.symfony }} --no-update
composer require symfony/event-dispatcher=${{ matrix.symfony }} --no-update
composer require symfony/css-selector=${{ matrix.symfony }} --no-update
composer require symfony/dom-crawler=${{ matrix.symfony }} --no-update
composer require symfony/browser-kit=${{ matrix.symfony }} --no-update
composer require symfony/finder=${{ env.COMP_SYMFONY }} --no-update
composer require symfony/yaml=${{ env.COMP_SYMFONY }} --no-update
composer require symfony/console=${{ env.COMP_SYMFONY }} --no-update
composer require symfony/event-dispatcher=${{ env.COMP_SYMFONY }} --no-update
composer require symfony/css-selector=${{ env.COMP_SYMFONY }} --no-update
composer require symfony/dom-crawler=${{ env.COMP_SYMFONY }} --no-update
composer require symfony/browser-kit=${{ env.COMP_SYMFONY }} --no-update
composer require vlucas/phpdotenv --no-update
composer require codeception/module-asserts="3.*" --no-update
composer require codeception/module-doctrine="3.*" --no-update

if [[ "$MATRIX_SYMFONY" == "6.4wApi" ]]; then
composer require codeception/module-rest="3.*" --no-update
fi

composer update --prefer-dist --no-progress --no-dev

- name: Validate Composer files
Expand All @@ -84,6 +103,11 @@ jobs:
php bin/console doctrine:fixtures:load --quiet
working-directory: framework-tests

- name: Generate JWT keypair
if: ${{ matrix.symfony == '6.4wApi' }}
run: php bin/console lexik:jwt:generate-keypair --skip-if-exists
working-directory: framework-tests

- name: Run tests
run: |
php vendor/bin/codecept build -c framework-tests
Expand Down
11 changes: 9 additions & 2 deletions src/Codeception/Lib/Connector/Symfony.php
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ protected function doRequest(object $request): Response
}

/**
* Reboot kernel
* Reboots the kernel.
*
* Services from the list of persistent services
* are updated from service container before kernel shutdown
Expand All @@ -66,7 +66,8 @@ public function rebootKernel(): void
}

$this->persistDoctrineConnections();
$this->kernel->reboot(null);
$this->ensureKernelShutdown();
$this->kernel->boot();
$this->container = $this->getContainer();

foreach ($this->persistentServices as $serviceName => $service) {
Expand All @@ -82,6 +83,12 @@ public function rebootKernel(): void
}
}

protected function ensureKernelShutdown(): void
{
$this->kernel->boot();
$this->kernel->shutdown();
}

private function getContainer(): ?ContainerInterface
{
/** @var ContainerInterface $container */
Expand Down