diff --git a/.github/workflows/php.yml b/.github/workflows/php.yml index 305016a..a8a11e4 100644 --- a/.github/workflows/php.yml +++ b/.github/workflows/php.yml @@ -14,7 +14,7 @@ jobs: strategy: matrix: operating-system: [ ubuntu-latest ] - php-versions: ['8.1', '8.2', '8.3'] + php-versions: ['8.2', '8.3', '8.4'] runs-on: ${{ matrix.operating-system }} diff --git a/.scrutinizer.yml b/.scrutinizer.yml index 3d703a6..c239586 100644 --- a/.scrutinizer.yml +++ b/.scrutinizer.yml @@ -1,7 +1,7 @@ build: environment: php: - version: 8.1 + version: 8.2 dependencies: before: diff --git a/CHANGELOG.md b/CHANGELOG.md index 4b4b6da..255d965 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,13 @@ All notable changes to this project will be documented in this file. The format is based on Keep a Changelog and this project adheres to Semantic Versioning. +## [Unreleased] + +### Changed +- **BREAKING:** PHP 8.2 or newer is required, as for quantum/framework 3.2: `composer.json` requires `php` `^8.2`, CI tests PHP 8.2, 8.3 and 8.4, and PHPStan and Rector target PHP 8.2. Projects on PHP 8.1 stay on 3.1.x (#220). +- **BREAKING:** `symfony/process` and `symfony/yaml` are updated to `^7.4` (they were `^5.4`), because the framework's `symfony/console` 7.4 conflicts with `symfony/process` below 6.4. A project that uses `symfony/process` or `symfony/yaml` directly gets their 7.4 versions (#220). +- The tests run on PHPUnit `^11.5` (it was `^9.0`) and Mockery `^1.6` (development dependencies). `phpunit.xml` drops the `verbose` attribute, which PHPUnit 11 no longer accepts, and names `shared` as the source for code coverage, which PHPUnit 11 requires for `composer test`, the tests use the `#[DataProvider]` attribute instead of the `@dataProvider` doc comment, and the feature tests tear down the app they boot in `setUp()`, together with the framework's error and exception handlers (#220). + ## [3.1.2] - 2026-11-19 ### Added diff --git a/README.md b/README.md index 1e71f43..69f2619 100644 --- a/README.md +++ b/README.md @@ -32,7 +32,7 @@

Installation

-

Requirements: PHP 8.1 or newer.

+

Requirements: PHP 8.2 or newer.

1. Create new project

diff --git a/composer.json b/composer.json index e1e0048..e361f05 100644 --- a/composer.json +++ b/composer.json @@ -25,17 +25,17 @@ }, "type": "project", "require": { - "php": "^8.1", - "quantum/framework": "^3.1.2", + "php": "^8.2", + "quantum/framework": "3.2.*@dev", "fakerphp/faker": "^1.15", "bluemmb/faker-picsum-photos-provider": "^2.0", "ottaviano/faker-gravatar": "^0.3.0", - "symfony/process": "^5.4", - "symfony/yaml": "^5.4.52" + "symfony/process": "^7.4", + "symfony/yaml": "^7.4" }, "require-dev": { - "phpunit/phpunit": "^9.0", - "mockery/mockery": "^1.2", + "phpunit/phpunit": "^11.5", + "mockery/mockery": "^1.6", "friendsofphp/php-cs-fixer": "^3.94", "rector/rector": "^2.3", "phpstan/phpstan": "^2.1" diff --git a/phpstan.neon.dist b/phpstan.neon.dist index 6870cdb..2ec8f03 100644 --- a/phpstan.neon.dist +++ b/phpstan.neon.dist @@ -1,5 +1,5 @@ parameters: - phpVersion: 80100 + phpVersion: 80200 level: 5 paths: - shared diff --git a/phpunit.xml b/phpunit.xml index 6e77e94..d6359f1 100644 --- a/phpunit.xml +++ b/phpunit.xml @@ -4,7 +4,6 @@ xsi:noNamespaceSchemaLocation="./vendor/phpunit/phpunit/phpunit.xsd" bootstrap="tests/bootstrap.php" colors="true" - verbose="true" stderr="true" stopOnFailure="false" > @@ -16,4 +15,9 @@ ./tests/Unit + + + ./shared + + \ No newline at end of file diff --git a/rector.php b/rector.php index 6a2a654..36a32cb 100644 --- a/rector.php +++ b/rector.php @@ -20,7 +20,7 @@ ClassPropertyAssignToConstructorPromotionRector::class, ]) ->withSets([ - LevelSetList::UP_TO_PHP_81, + LevelSetList::UP_TO_PHP_82, SetList::TYPE_DECLARATION, ]) ->withRules([ diff --git a/tests/Feature/AppTestCase.php b/tests/Feature/AppTestCase.php index f902733..c6501f1 100644 --- a/tests/Feature/AppTestCase.php +++ b/tests/Feature/AppTestCase.php @@ -2,11 +2,15 @@ namespace Quantum\Tests\Feature; +use Quantum\App\Factories\AppFactory; +use Quantum\Tracer\ErrorHandler; use PHPUnit\Framework\TestCase; use Quantum\App\Enums\AppType; use Quantum\Http\Response; -use Quantum\App\App; +use ReflectionFunction; use RuntimeException; +use Quantum\App\App; +use Closure; class AppTestCase extends TestCase { @@ -33,6 +37,8 @@ public function setUp(): void public function tearDown(): void { $this->clearRateLimitStorage(); + AppFactory::destroy(AppType::WEB); + $this->removeFrameworkErrorHandlers(); parent::tearDown(); ob_end_clean(); } @@ -59,6 +65,34 @@ protected function signInAndGetTokens(): array return $response->get('tokens'); } + /** + * Removes the error and exception handlers that the framework's ErrorHandler registered + * when setUp() booted the app; the handlers of the console app that tests/bootstrap.php + * boots once stay in place + */ + private function removeFrameworkErrorHandlers(): void + { + $isFrameworkHandler = $this->isFrameworkHandler(set_error_handler(static fn (): bool => false)); + restore_error_handler(); + + if ($isFrameworkHandler) { + restore_error_handler(); + } + + $isFrameworkHandler = $this->isFrameworkHandler(set_exception_handler(static function (): void { + })); + restore_exception_handler(); + + if ($isFrameworkHandler) { + restore_exception_handler(); + } + } + + private function isFrameworkHandler(mixed $handler): bool + { + return $handler instanceof Closure && (new ReflectionFunction($handler))->getClosureThis() instanceof ErrorHandler; + } + private function clearRateLimitStorage(): void { $rateLimitDir = PROJECT_ROOT . DS . 'cache' . DS . 'data'; diff --git a/tests/Unit/shared/Lang/CommonLangTest.php b/tests/Unit/shared/Lang/CommonLangTest.php index ac6747c..899bd9b 100644 --- a/tests/Unit/shared/Lang/CommonLangTest.php +++ b/tests/Unit/shared/Lang/CommonLangTest.php @@ -2,6 +2,7 @@ namespace Quantum\Tests\Unit\shared\Lang; +use PHPUnit\Framework\Attributes\DataProvider; use PHPUnit\Framework\TestCase; class CommonLangTest extends TestCase @@ -31,9 +32,7 @@ class CommonLangTest extends TestCase 'token', ]; - /** - * @dataProvider languageProvider - */ + #[DataProvider('languageProvider')] public function testEveryLanguageHasTheStarTexts(string $language): void { $star = $this->texts($language, 'pages')['star'] ?? null; @@ -64,9 +63,7 @@ public function testEnglishTextAsksForAStarOnGitHub(): void $this->assertSame('GitHub stars', $star['badge_alt'] ?? null); } - /** - * @dataProvider languageProvider - */ + #[DataProvider('languageProvider')] public function testCommonKeepsTheKeysTheFrameworkReadsByName(string $language): void { $keys = $this->flatten($this->texts($language, 'common')); @@ -79,9 +76,7 @@ public function testCommonKeepsTheKeysTheFrameworkReadsByName(string $language): $this->assertSame([], array_values(array_diff(array_keys($keys), self::COMMON_KEYS))); } - /** - * @dataProvider languageProvider - */ + #[DataProvider('languageProvider')] public function testCommentMessagesAreTranslated(string $language): void { $comments = $this->texts($language, 'comments');