Skip to content
Draft
Show file tree
Hide file tree
Changes from 2 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
5 changes: 3 additions & 2 deletions .github/workflows/cs-fix.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,5 +12,6 @@ jobs:
permissions:
contents: write
uses: spiral/gh-actions/.github/workflows/cs-fix.yml@master

...
with:
php: >-
['8.4']
2 changes: 2 additions & 0 deletions .github/workflows/phpunit.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,5 @@ jobs:
['ubuntu-latest']
stability: >-
['prefer-lowest', 'prefer-stable']
php: >-
['8.4']
2 changes: 2 additions & 0 deletions .github/workflows/psalm.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,5 @@ jobs:
with:
os: >-
['ubuntu-latest']
php: >-
['8.4']
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,6 @@
/vendor/
/.env
/composer.lock
/.phpunit.result.cache
*.log
*.exe
8 changes: 3 additions & 5 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -43,10 +43,10 @@
],
"require": {
"ext-json": "*",
"php": ">=8.1",
"php": ">=8.4",
"nyholm/psr7": "^1.8.2",
"mockery/mockery": "^1.6.12",
"phpunit/phpunit": "^9.6 || 10.5.45",
"phpunit/phpunit": "^13.0.5",
"spiral/auth": "^3.16",
"spiral/auth-http": "^3.16",
"spiral/boot": "^3.16",
Expand All @@ -65,9 +65,6 @@
"spiral/scaffolder": "^3.16",
"symfony/mime": "^6.4.18 || ^7.2 || ^8.0"
},
"conflict": {
"phpunit/phpunit": ">10.5.45"
},
"suggest": {
"brianium/paratest": "Required to run tests in parallel (^6.0).",
"ext-gd": "Required to use generate fake image files"
Expand Down Expand Up @@ -95,6 +92,7 @@
"minimum-stability": "dev",
"prefer-stable": true,
"config": {
"lock": false,
"sort-packages": true,
"allow-plugins": {
"spiral/composer-publish-plugin": false
Expand Down
68 changes: 27 additions & 41 deletions phpunit.xml
Original file line number Diff line number Diff line change
@@ -1,43 +1,29 @@
<?xml version="1.0" encoding="UTF-8"?>
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="vendor/phpunit/phpunit/phpunit.xsd"
cacheResultFile="runtime/phpunit/result.cache"
bootstrap="vendor/autoload.php"
backupGlobals="false"
colors="true"
processIsolation="false"
stopOnFailure="false"
executionOrder="random"
failOnWarning="true"
failOnRisky="true"
failOnEmptyTestSuite="true"
beStrictAboutOutputDuringTests="true"
backupStaticProperties="false"
>
<testsuites>
<testsuite name="Test Suite">
<directory>tests</directory>
</testsuite>
</testsuites>
<coverage>
<report>
<html outputDirectory="runtime/coverage"/>
<text outputFile="runtime/coverage.txt"/>
<clover outputFile="runtime/logs/clover.xml"/>
</report>
</coverage>
<logging>
<junit outputFile="runtime/report.junit.xml"/>
</logging>
<source>
<include>
<directory>src</directory>
</include>
<exclude>
<directory>tests</directory>
</exclude>
</source>
<php>
<env name="DEBUG" value="true"/>
</php>
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="vendor/phpunit/phpunit/phpunit.xsd" bootstrap="vendor/autoload.php" backupGlobals="false" colors="true" processIsolation="false" stopOnFailure="false" executionOrder="random" failOnWarning="true" failOnRisky="true" failOnEmptyTestSuite="true" beStrictAboutOutputDuringTests="true" backupStaticProperties="false">
<testsuites>
<testsuite name="Test Suite">
<directory>tests</directory>
</testsuite>
</testsuites>
<coverage>
<report>
<html outputDirectory="runtime/coverage"/>
<text outputFile="runtime/coverage.txt"/>
<clover outputFile="runtime/logs/clover.xml"/>
</report>
</coverage>
<logging>
<junit outputFile="runtime/report.junit.xml"/>
</logging>
<source>
<include>
<directory>src</directory>
</include>
<exclude>
<directory>tests</directory>
</exclude>
</source>
<php>
<env name="DEBUG" value="true"/>
</php>
</phpunit>
8 changes: 4 additions & 4 deletions src/TestCase.php
Original file line number Diff line number Diff line change
Expand Up @@ -228,16 +228,16 @@ protected function tearDownTraits(): void
$this->runTraitSetUpOrTearDown('tearDown');
}

protected function runTest(): mixed
protected function invokeTestMethod(string $methodName, array $testArguments): mixed
{
$scope = $this->getTestScope();
if ($scope === null) {
return parent::runTest();
return parent::invokeTestMethod($methodName, $testArguments);
}

$scopes = \is_array($scope->scope) ? $scope->scope : [$scope->scope];
$result = self::runScopes($scopes, function (): mixed {
return parent::runTest();
$result = self::runScopes($scopes, function () use ($methodName, $testArguments): mixed {
return parent::invokeTestMethod($methodName, $testArguments);
}, $this->getContainer(), $scope->bindings);

return $result;
Expand Down
2 changes: 2 additions & 0 deletions tests/src/Traits/InteractsWithDispatcherTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

namespace Spiral\Testing\Tests\Traits;

use PHPUnit\Framework\Attributes\AllowMockObjectsWithoutExpectations;
use Spiral\Boot\DispatcherInterface;
use Spiral\Boot\Environment;
use Spiral\Boot\EnvironmentInterface;
Expand Down Expand Up @@ -69,6 +70,7 @@ public function canServe(EnvironmentInterface $env): bool
$this->assertDispatcherCannotBeServed($dispatcher::class);
}

#[AllowMockObjectsWithoutExpectations]
public function testGetRegisteredDispatchers(): void
{
$dispatcherA = $this->createMock(DispatcherInterface::class);
Expand Down