From 4da99d389721f7bb6d3b1a9b7c2c7613080829f0 Mon Sep 17 00:00:00 2001 From: Nikolaos Dimopoulos Date: Fri, 3 Jul 2026 22:13:00 -0500 Subject: [PATCH 1/4] Fixing deprecation warning Assisted-by: Claude Code --- tests/Fakes/Browser/app.php | 1 - 1 file changed, 1 deletion(-) diff --git a/tests/Fakes/Browser/app.php b/tests/Fakes/Browser/app.php index 0d8fac5..10551a6 100644 --- a/tests/Fakes/Browser/app.php +++ b/tests/Fakes/Browser/app.php @@ -23,7 +23,6 @@ // session.* warns once a session has started. if (PHP_SESSION_NONE === session_status()) { ini_set('session.use_cookies', '0'); - ini_set('session.use_only_cookies', '0'); ini_set('session.cache_limiter', ''); } From 190bfe369f5c9bcb61307b1ba524ee63b3be0653 Mon Sep 17 00:00:00 2001 From: Nikolaos Dimopoulos Date: Thu, 9 Jul 2026 23:28:11 -0500 Subject: [PATCH 2/4] [#14] - adding guard for di reset --- src/PHPUnit/AbstractUnitTestCase.php | 4 ++- .../Unit/PHPUnit/AbstractUnitTestCaseTest.php | 26 +++++++++++++++++++ 2 files changed, 29 insertions(+), 1 deletion(-) diff --git a/src/PHPUnit/AbstractUnitTestCase.php b/src/PHPUnit/AbstractUnitTestCase.php index c119735..852d67b 100644 --- a/src/PHPUnit/AbstractUnitTestCase.php +++ b/src/PHPUnit/AbstractUnitTestCase.php @@ -39,7 +39,9 @@ protected function setUp(): void { parent::setUp(); - Di::reset(); + if ($this->phalconAvailable()) { + Di::reset(); + } } public function checkExtensionIsLoaded(string $extension): void diff --git a/tests/Unit/PHPUnit/AbstractUnitTestCaseTest.php b/tests/Unit/PHPUnit/AbstractUnitTestCaseTest.php index 1d5e134..f2adad7 100644 --- a/tests/Unit/PHPUnit/AbstractUnitTestCaseTest.php +++ b/tests/Unit/PHPUnit/AbstractUnitTestCaseTest.php @@ -106,6 +106,32 @@ public function testSetUpResetsTheDefaultDi(): void $this->assertNull(Di::getDefault()); } + public function testSetUpSkipsDiResetWhenPhalconIsNotAvailable(): void + { + $default = new FactoryDefault(); + Di::setDefault($default); + + // A test case that reports Phalcon as unavailable must not touch the DI, + // so packages without Phalcon/DI can still use the Talon abstracts. + $withoutPhalcon = new class ('runSetUp') extends AbstractUnitTestCase { + public function runSetUp(): void + { + $this->setUp(); + } + + protected function phalconAvailable(): bool + { + return false; + } + }; + + $withoutPhalcon->runSetUp(); + + $this->assertSame($default, Di::getDefault()); + + Di::reset(); + } + public function testHelperMethodVisibility(): void { // Execute each helper so this test covers the mutated method bodies From 4f3ea7e50fd8088e7eec8c55c838117c2b785f3b Mon Sep 17 00:00:00 2001 From: Nikolaos Dimopoulos Date: Thu, 9 Jul 2026 23:29:59 -0500 Subject: [PATCH 3/4] [#14] - updating changelog --- CHANGELOG.md | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 2c14a4c..3dace1d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,17 @@ # Changelog +## [0.7.0](https://github.com/phalcon/talon/releases/tag/v0.7.0) (2026-07-10) + +### Changed + +### Added + +### Fixed + +- `AbstractUnitTestCase::setUp()` now guards its `Di::reset()` call behind `phalconAvailable()`, so packages that use the Talon abstract test cases without Phalcon (or without the DI component) no longer hit a fatal `Class "Phalcon\Di\Di" not found` at setup time - because `AbstractUnitTestCase` is the root of the hierarchy, every abstract (`AbstractServicesTestCase`/`AbstractDatabaseTestCase`/`AbstractBrowserTestCase`/`AbstractFunctionalTestCase`) inherits the fix and can be extended without a DI. When Phalcon is available the reset still runs unchanged. [#14](https://github.com/phalcon/talon/issues/14) + +### Removed + ## [0.6.0](https://github.com/phalcon/talon/releases/tag/v0.6.0) (2026-07-02) ### Changed From db62768d0bb1b3bd85157a6edeb2a5c86ae2c779 Mon Sep 17 00:00:00 2001 From: Nikolaos Dimopoulos Date: Fri, 10 Jul 2026 07:02:43 -0500 Subject: [PATCH 4/4] [#14] - fixing bug discovered by infection Assisted-by: Claude Code --- CHANGELOG.md | 1 + src/PHPUnit/AbstractBrowserTestCase.php | 9 +++++++++ 2 files changed, 10 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 3dace1d..2746932 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,6 +9,7 @@ ### Fixed - `AbstractUnitTestCase::setUp()` now guards its `Di::reset()` call behind `phalconAvailable()`, so packages that use the Talon abstract test cases without Phalcon (or without the DI component) no longer hit a fatal `Class "Phalcon\Di\Di" not found` at setup time - because `AbstractUnitTestCase` is the root of the hierarchy, every abstract (`AbstractServicesTestCase`/`AbstractDatabaseTestCase`/`AbstractBrowserTestCase`/`AbstractFunctionalTestCase`) inherits the fix and can be extended without a DI. When Phalcon is available the reset still runs unchanged. [#14](https://github.com/phalcon/talon/issues/14) +- `AbstractBrowserTestCase` now clears `$_SESSION` in `tearDown()` as well as `setUp()`, so a test that logs a user in no longer leaks that session into a following test that does not reset it itself. The browser fixture session persists across the in-process app rebuilds and `Di::reset()` does not clear it, which surfaced as a random-order failure of `FixtureSmokeTest::testSecuredShowsGuestWithoutSession` (it read a `sarah` session left behind by `BrowserTraitTest`). [#16](https://github.com/phalcon/talon/pull/16) ### Removed diff --git a/src/PHPUnit/AbstractBrowserTestCase.php b/src/PHPUnit/AbstractBrowserTestCase.php index 2fa94c9..2b9f0e3 100644 --- a/src/PHPUnit/AbstractBrowserTestCase.php +++ b/src/PHPUnit/AbstractBrowserTestCase.php @@ -29,4 +29,13 @@ protected function setUp(): void // session across requests within a test; clear it between tests). $_SESSION = []; } + + protected function tearDown(): void + { + // Clear on the way out too, so a logged-in session is not leaked into a + // following test that does not reset it itself. + $_SESSION = []; + + parent::tearDown(); + } }