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
2 changes: 1 addition & 1 deletion .github/workflows/php.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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 }}

Expand Down
2 changes: 1 addition & 1 deletion .scrutinizer.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
build:
environment:
php:
version: 8.1
version: 8.2

dependencies:
before:
Expand Down
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@

<h2>Installation</h2>

<p><strong>Requirements:</strong> PHP 8.1 or newer.</p>
<p><strong>Requirements:</strong> PHP 8.2 or newer.</p>

<h3> 1. Create new project </h3>

Expand Down
12 changes: 6 additions & 6 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
2 changes: 1 addition & 1 deletion phpstan.neon.dist
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
parameters:
phpVersion: 80100
phpVersion: 80200
level: 5
paths:
- shared
Expand Down
6 changes: 5 additions & 1 deletion phpunit.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
xsi:noNamespaceSchemaLocation="./vendor/phpunit/phpunit/phpunit.xsd"
bootstrap="tests/bootstrap.php"
colors="true"
verbose="true"
stderr="true"
stopOnFailure="false"
>
Expand All @@ -16,4 +15,9 @@
<directory>./tests/Unit</directory>
</testsuite>
</testsuites>
<source>
<include>
<directory suffix=".php">./shared</directory>
</include>
</source>
</phpunit>
2 changes: 1 addition & 1 deletion rector.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
ClassPropertyAssignToConstructorPromotionRector::class,
])
->withSets([
LevelSetList::UP_TO_PHP_81,
LevelSetList::UP_TO_PHP_82,
SetList::TYPE_DECLARATION,
])
->withRules([
Expand Down
36 changes: 35 additions & 1 deletion tests/Feature/AppTestCase.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
{
Expand All @@ -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();
}
Expand All @@ -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';
Expand Down
13 changes: 4 additions & 9 deletions tests/Unit/shared/Lang/CommonLangTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

namespace Quantum\Tests\Unit\shared\Lang;

use PHPUnit\Framework\Attributes\DataProvider;
use PHPUnit\Framework\TestCase;

class CommonLangTest extends TestCase
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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'));
Expand All @@ -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');
Expand Down
Loading