From c4087d8364b7b3e2308470129f56dabb437cc94c Mon Sep 17 00:00:00 2001 From: TavoNiievez Date: Fri, 27 May 2022 17:09:52 -0500 Subject: [PATCH 1/3] Symfony 6 Support: FormAssertionsTrait --- src/Codeception/Module/Symfony/FormAssertionsTrait.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Codeception/Module/Symfony/FormAssertionsTrait.php b/src/Codeception/Module/Symfony/FormAssertionsTrait.php index ec84212b..3b923059 100644 --- a/src/Codeception/Module/Symfony/FormAssertionsTrait.php +++ b/src/Codeception/Module/Symfony/FormAssertionsTrait.php @@ -50,7 +50,7 @@ public function seeFormErrorMessage(string $field, ?string $message = null): voi { $formCollector = $this->grabFormCollector(__FUNCTION__); - if (!$forms = $formCollector->getData()->getValue('forms')['forms']) { + if (!$forms = $formCollector->getData()->getValue(true)['forms']) { $this->fail('There are no forms on the current page.'); } From f1ec537bfe8834eb43d447bbda3714bcd4b4da5e Mon Sep 17 00:00:00 2001 From: TavoNiievez Date: Fri, 27 May 2022 17:10:12 -0500 Subject: [PATCH 2/3] Symfony 6 Support: SessionAssertionsTrait --- .../Module/Symfony/SessionAssertionsTrait.php | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/src/Codeception/Module/Symfony/SessionAssertionsTrait.php b/src/Codeception/Module/Symfony/SessionAssertionsTrait.php index 73a440dc..e7ff9cbb 100644 --- a/src/Codeception/Module/Symfony/SessionAssertionsTrait.php +++ b/src/Codeception/Module/Symfony/SessionAssertionsTrait.php @@ -82,11 +82,12 @@ public function dontSeeInSession(string $attribute, $value = null): void { $session = $this->getCurrentSession(); - if (null === $value) { - if ($session->has($attribute)) { - $this->fail("Session attribute with name '{$attribute}' does exist"); - } - } else { + if ($attributeExists = $session->has($attribute)) { + $this->fail("Session attribute with name '{$attribute}' does exist"); + } + $this->assertFalse($attributeExists); + + if (null !== $value) { $this->assertNotSame($value, $session->get($attribute)); } } @@ -167,9 +168,10 @@ public function seeInSession(string $attribute, $value = null): void { $session = $this->getCurrentSession(); - if (!$session->has($attribute)) { + if (!$attributeExists = $session->has($attribute)) { $this->fail("No session attribute with name '{$attribute}'"); } + $this->assertTrue($attributeExists); if (null !== $value) { $this->assertSame($value, $session->get($attribute)); From bbd2b7dcb7bba17425a6183c5167ca5078b08a87 Mon Sep 17 00:00:00 2001 From: TavoNiievez Date: Fri, 27 May 2022 17:10:26 -0500 Subject: [PATCH 3/3] Add Symfony 6 tests --- .github/workflows/main.yml | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 0c991a8c..f9ef116b 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -9,7 +9,7 @@ jobs: strategy: matrix: php: [8.0, 8.1] - symfony: ["4.4.*", "5.4.*"] + symfony: ["4.4.*", "5.4.*", "6.0.*"] steps: - name: Checkout code @@ -29,7 +29,7 @@ jobs: with: repository: Codeception/symfony-module-tests path: framework-tests - ref: 4.4_codecept5 + ref: "4.4_codecept5" - name: Checkout Symfony 5.4 Sample if: "matrix.symfony == '5.4.*'" @@ -37,7 +37,15 @@ jobs: with: repository: Codeception/symfony-module-tests path: framework-tests - ref: 5.4_codecept5 + ref: "5.4_codecept5" + + - name: Checkout Symfony 6.0 Sample + if: "matrix.symfony == '6.0.*'" + uses: actions/checkout@v2 + with: + repository: Codeception/symfony-module-tests + path: framework-tests + ref: "6.0" - name: Get composer cache directory id: composer-cache