From 546b0fb29ed53e145534a8544660c07b4a4cfd12 Mon Sep 17 00:00:00 2001 From: Filippo Tessarotto Date: Tue, 17 Mar 2020 11:46:26 +0100 Subject: [PATCH 1/3] Prove session persistance bug between tests --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 60a490b3..1fbbe53b 100644 --- a/.travis.yml +++ b/.travis.yml @@ -16,7 +16,7 @@ install: - '[[ -z "$CI_USER_TOKEN" ]] || composer config github-oauth.github.com ${CI_USER_TOKEN};' - travis_retry composer self-update && composer --version - travis_retry composer update --prefer-dist --no-interaction - - git clone -q --depth=1 -b master --recurse-submodules https://github.com/Slamdunk/codeception-mezzio-tests framework-tests + - git clone -q --depth=1 -b session_test --recurse-submodules https://github.com/Slamdunk/codeception-mezzio-tests framework-tests - git --git-dir framework-tests/.git log -n 1 - travis_retry composer update -d framework-tests --no-dev --prefer-dist --no-interaction - php ./vendor/bin/codecept build -c framework-tests From 500ca73d6e143988198527cb9014610a45f42623 Mon Sep 17 00:00:00 2001 From: Filippo Tessarotto Date: Tue, 17 Mar 2020 11:53:08 +0100 Subject: [PATCH 2/3] Unset session after test --- .travis.yml | 2 +- src/Codeception/Module/Mezzio.php | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 1fbbe53b..60a490b3 100644 --- a/.travis.yml +++ b/.travis.yml @@ -16,7 +16,7 @@ install: - '[[ -z "$CI_USER_TOKEN" ]] || composer config github-oauth.github.com ${CI_USER_TOKEN};' - travis_retry composer self-update && composer --version - travis_retry composer update --prefer-dist --no-interaction - - git clone -q --depth=1 -b session_test --recurse-submodules https://github.com/Slamdunk/codeception-mezzio-tests framework-tests + - git clone -q --depth=1 -b master --recurse-submodules https://github.com/Slamdunk/codeception-mezzio-tests framework-tests - git --git-dir framework-tests/.git log -n 1 - travis_retry composer update -d framework-tests --no-dev --prefer-dist --no-interaction - php ./vendor/bin/codecept build -c framework-tests diff --git a/src/Codeception/Module/Mezzio.php b/src/Codeception/Module/Mezzio.php index 157dd595..0742e089 100644 --- a/src/Codeception/Module/Mezzio.php +++ b/src/Codeception/Module/Mezzio.php @@ -84,6 +84,9 @@ public function _after(TestInterface $test) if (session_status() == PHP_SESSION_ACTIVE) { session_write_close(); } + if (isset($_SESSION)) { + session_unset(); + } parent::_after($test); } From d9f3bb57895ee0542602af7465024cfa4e2e96ff Mon Sep 17 00:00:00 2001 From: Filippo Tessarotto Date: Tue, 17 Mar 2020 12:07:05 +0100 Subject: [PATCH 3/3] session_unset is ineffective; just set it to empty array --- src/Codeception/Module/Mezzio.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Codeception/Module/Mezzio.php b/src/Codeception/Module/Mezzio.php index 0742e089..2d9614b9 100644 --- a/src/Codeception/Module/Mezzio.php +++ b/src/Codeception/Module/Mezzio.php @@ -85,7 +85,7 @@ public function _after(TestInterface $test) session_write_close(); } if (isset($_SESSION)) { - session_unset(); + $_SESSION = []; } parent::_after($test);