diff --git a/.scrutinizer.yml b/.scrutinizer.yml
index 01fda8a8a..f52542844 100644
--- a/.scrutinizer.yml
+++ b/.scrutinizer.yml
@@ -3,7 +3,7 @@ build:
environment:
php:
- version: 8.1.2
+ version: 8.1.18
ini:
"xdebug.mode": coverage
@@ -24,7 +24,7 @@ build:
phpunit:
tests:
override:
- - command: "./vendor/bin/phpunit --coverage-clover ./coverage.xml"
+ - command: "./vendor/bin/phpunit --exclude-group scrutinizer-ignore --coverage-clover ./coverage.xml"
on_node: 1
coverage:
file: coverage.xml
diff --git a/README.md b/README.md
index 807af267f..d4b5dcda0 100644
--- a/README.md
+++ b/README.md
@@ -1,4 +1,3 @@
-
@@ -69,6 +68,6 @@ the PHP code of your application stays in memory permanently (anti-memory leak t
> **Note**:
> You can find more community packages in [spiral-packages](https://github.com/spiral-packages/) organization.
-License:
---------
+## License:
+
MIT License (MIT). Please see [`LICENSE`](./LICENSE) for more information. Maintained by [Spiral Scout](https://spiralscout.com).
diff --git a/composer.json b/composer.json
index 4bd1a36a5..51c82d398 100644
--- a/composer.json
+++ b/composer.json
@@ -130,13 +130,13 @@
"league/flysystem-aws-s3-v3": "^2.0",
"mikey179/vfsstream": "^1.6",
"mockery/mockery": "^1.5",
- "phpunit/phpunit": "^9.5.20",
+ "phpunit/phpunit": "^10.1",
"ramsey/collection": "^1.2",
"ramsey/uuid": "^4.2.3",
"rector/rector": "0.15.23",
"spiral/code-style": "^1.1",
"spiral/nyholm-bridge": "^1.2",
- "spiral/testing": "^2.2",
+ "spiral/testing": "^2.3",
"spiral/validator": "^1.2",
"symplify/monorepo-builder": "^10.2.7",
"vimeo/psalm": "^5.9"
diff --git a/monorepo-builder.php b/monorepo-builder.php
index c6a7c46da..61eccd682 100644
--- a/monorepo-builder.php
+++ b/monorepo-builder.php
@@ -98,7 +98,7 @@
],
],
'require-dev' => [
- 'phpunit/phpunit' => '^9.5.20',
+ 'phpunit/phpunit' => '^10.1',
'mockery/mockery' => '^1.5',
'spiral/code-style' => '^1.1',
'symplify/monorepo-builder' => '^10.2.7',
diff --git a/phpunit.xml b/phpunit.xml
index d4e2ef005..7cac51242 100644
--- a/phpunit.xml
+++ b/phpunit.xml
@@ -3,31 +3,27 @@
xsi:noNamespaceSchemaLocation="vendor/phpunit/phpunit/phpunit.xsd"
bootstrap="vendor/autoload.php"
backupGlobals="false"
- backupStaticAttributes="false"
colors="true"
- verbose="false"
- convertErrorsToExceptions="true"
- convertNoticesToExceptions="true"
- convertWarningsToExceptions="true"
processIsolation="false"
failOnRisky="false"
stopOnFailure="false"
stopOnError="false"
- stderr="true">
+ stderr="true"
+ cacheDirectory=".phpunit.cache"
+ backupStaticProperties="false">
-
- src
- src/*/src
-
-
- src/*/tests
- tests
-
+
+
+
+
+
+
+
+
- src/*/tests
- src/*/tests
+ src/*/tests
tests
@@ -37,4 +33,14 @@
+
+
+ src
+ src/*/src
+
+
+ src/*/tests
+ tests
+
+
diff --git a/src/AnnotatedRoutes/composer.json b/src/AnnotatedRoutes/composer.json
index 077933257..5c7024c06 100644
--- a/src/AnnotatedRoutes/composer.json
+++ b/src/AnnotatedRoutes/composer.json
@@ -38,7 +38,7 @@
},
"require-dev": {
"mockery/mockery": "^1.5",
- "phpunit/phpunit": "^9.5.20",
+ "phpunit/phpunit": "^10.1",
"spiral/framework": "^3.1",
"spiral/nyholm-bridge": "^1.2",
"vimeo/psalm": "^5.9"
diff --git a/src/Auth/composer.json b/src/Auth/composer.json
index f4a7f73bc..18eb3f20a 100644
--- a/src/Auth/composer.json
+++ b/src/Auth/composer.json
@@ -31,7 +31,7 @@
"psr/event-dispatcher": "^1.0"
},
"require-dev": {
- "phpunit/phpunit": "^9.5.20",
+ "phpunit/phpunit": "^10.1",
"vimeo/psalm": "^5.9"
},
"autoload": {
diff --git a/src/AuthHttp/composer.json b/src/AuthHttp/composer.json
index 7aeef14f1..76d706ca0 100644
--- a/src/AuthHttp/composer.json
+++ b/src/AuthHttp/composer.json
@@ -34,7 +34,7 @@
"psr/event-dispatcher": "^1.0"
},
"require-dev": {
- "phpunit/phpunit": "^9.5.20",
+ "phpunit/phpunit": "^10.1",
"spiral/cookies": "^3.8",
"spiral/http": "^3.8",
"spiral/debug": "^3.8",
diff --git a/src/AuthHttp/tests/BaseTest.php b/src/AuthHttp/tests/BaseTestCase.php
similarity index 90%
rename from src/AuthHttp/tests/BaseTest.php
rename to src/AuthHttp/tests/BaseTestCase.php
index 6e5ee6065..e35fff70b 100644
--- a/src/AuthHttp/tests/BaseTest.php
+++ b/src/AuthHttp/tests/BaseTestCase.php
@@ -9,7 +9,7 @@
use Spiral\Telemetry\NullTracer;
use Spiral\Telemetry\TracerInterface;
-abstract class BaseTest extends TestCase
+abstract class BaseTestCase extends TestCase
{
protected Container $container;
diff --git a/src/AuthHttp/tests/CookieTransportTest.php b/src/AuthHttp/tests/CookieTransportTest.php
index 298ad2de6..86fcc88d9 100644
--- a/src/AuthHttp/tests/CookieTransportTest.php
+++ b/src/AuthHttp/tests/CookieTransportTest.php
@@ -20,7 +20,7 @@
use Spiral\Tests\Auth\Stub\TestAuthHttpStorage;
use Spiral\Tests\Auth\Stub\TestAuthHttpToken;
-class CookieTransportTest extends BaseTest
+class CookieTransportTest extends BaseTestCase
{
public function testCookieToken(): void
{
diff --git a/src/AuthHttp/tests/Middleware/AuthMiddlewareTest.php b/src/AuthHttp/tests/Middleware/AuthMiddlewareTest.php
index db5d75e3c..8031bbf1f 100644
--- a/src/AuthHttp/tests/Middleware/AuthMiddlewareTest.php
+++ b/src/AuthHttp/tests/Middleware/AuthMiddlewareTest.php
@@ -12,13 +12,13 @@
use Spiral\Http\Config\HttpConfig;
use Spiral\Http\Http;
use Spiral\Http\Pipeline;
-use Spiral\Tests\Auth\BaseTest;
+use Spiral\Tests\Auth\BaseTestCase;
use Spiral\Tests\Auth\Diactoros\ResponseFactory;
use Nyholm\Psr7\ServerRequest;
use Spiral\Tests\Auth\Stub\TestAuthHttpProvider;
use Spiral\Tests\Auth\Stub\TestAuthHttpStorage;
-class AuthMiddlewareTest extends BaseTest
+class AuthMiddlewareTest extends BaseTestCase
{
public function testAttributeRead(): void
{
diff --git a/src/AuthHttp/tests/Middleware/AuthTransportMiddlewareTest.php b/src/AuthHttp/tests/Middleware/AuthTransportMiddlewareTest.php
index 942db677d..80ee4a0f6 100644
--- a/src/AuthHttp/tests/Middleware/AuthTransportMiddlewareTest.php
+++ b/src/AuthHttp/tests/Middleware/AuthTransportMiddlewareTest.php
@@ -12,11 +12,11 @@
use Spiral\Auth\TransportRegistry;
use Spiral\Core\Container\Autowire;
use Spiral\Core\ScopeInterface;
-use Spiral\Tests\Auth\BaseTest;
+use Spiral\Tests\Auth\BaseTestCase;
use Spiral\Tests\Auth\Stub\TestAuthHttpProvider;
use Spiral\Tests\Auth\Stub\TestAuthHttpStorage;
-final class AuthTransportMiddlewareTest extends BaseTest
+final class AuthTransportMiddlewareTest extends BaseTestCase
{
protected function setUp(): void
{
diff --git a/src/AuthHttp/tests/Middleware/Firewall/BaseFirewallTest.php b/src/AuthHttp/tests/Middleware/Firewall/BaseFirewallTestCase.php
similarity index 87%
rename from src/AuthHttp/tests/Middleware/Firewall/BaseFirewallTest.php
rename to src/AuthHttp/tests/Middleware/Firewall/BaseFirewallTestCase.php
index ff031c8a3..c6feb52e6 100644
--- a/src/AuthHttp/tests/Middleware/Firewall/BaseFirewallTest.php
+++ b/src/AuthHttp/tests/Middleware/Firewall/BaseFirewallTestCase.php
@@ -11,12 +11,12 @@
use Spiral\Http\Config\HttpConfig;
use Spiral\Http\Http;
use Spiral\Http\Pipeline;
-use Spiral\Tests\Auth\BaseTest;
+use Spiral\Tests\Auth\BaseTestCase;
use Spiral\Tests\Auth\Diactoros\ResponseFactory;
use Spiral\Tests\Auth\Stub\TestAuthHttpProvider;
use Spiral\Tests\Auth\Stub\TestAuthHttpStorage;
-abstract class BaseFirewallTest extends BaseTest
+abstract class BaseFirewallTestCase extends BaseTestCase
{
protected function getCore(AbstractFirewall $firewall, HttpTransportInterface $transport): Http
{
@@ -50,13 +50,13 @@ protected function getCore(AbstractFirewall $firewall, HttpTransportInterface $t
return $http;
}
- public function successTokensDataProvider(): \Traversable
+ public static function successTokensDataProvider(): \Traversable
{
// ok
yield ['ok'];
}
- public function failTokensDataProvider(): \Traversable
+ public static function failTokensDataProvider(): \Traversable
{
// Actor not found
yield ['no-actor'];
diff --git a/src/AuthHttp/tests/Middleware/Firewall/ExceptionFirewallTest.php b/src/AuthHttp/tests/Middleware/Firewall/ExceptionFirewallTest.php
index 87f7994aa..70490d46f 100644
--- a/src/AuthHttp/tests/Middleware/Firewall/ExceptionFirewallTest.php
+++ b/src/AuthHttp/tests/Middleware/Firewall/ExceptionFirewallTest.php
@@ -5,17 +5,16 @@
namespace Spiral\Tests\Auth\Middleware\Firewall;
use Nyholm\Psr7\ServerRequest;
+use PHPUnit\Framework\Attributes\DataProvider;
use Psr\Http\Message\ResponseInterface;
use Psr\Http\Message\ServerRequestInterface;
use Spiral\Auth\Exception\AuthException;
use Spiral\Auth\Middleware\Firewall\ExceptionFirewall;
use Spiral\Auth\Transport\HeaderTransport;
-final class ExceptionFirewallTest extends BaseFirewallTest
+final class ExceptionFirewallTest extends BaseFirewallTestCase
{
- /**
- * @dataProvider successTokensDataProvider
- */
+ #[DataProvider('successTokensDataProvider')]
public function testExceptionFirewallNotThrowException(string $token): void
{
$http = $this->getCore(
@@ -35,9 +34,7 @@ static function (ServerRequestInterface $request, ResponseInterface $response):
$this->assertSame('OK', (string) $response->getBody());
}
- /**
- * @dataProvider failTokensDataProvider
- */
+ #[DataProvider('failTokensDataProvider')]
public function testExceptionFirewallThrowException(string $token): void
{
$http = $this->getCore(
diff --git a/src/AuthHttp/tests/Middleware/Firewall/OverwriteFirewallTest.php b/src/AuthHttp/tests/Middleware/Firewall/OverwriteFirewallTest.php
index c668d62b9..abec83895 100644
--- a/src/AuthHttp/tests/Middleware/Firewall/OverwriteFirewallTest.php
+++ b/src/AuthHttp/tests/Middleware/Firewall/OverwriteFirewallTest.php
@@ -6,17 +6,16 @@
use Nyholm\Psr7\ServerRequest;
use Nyholm\Psr7\Uri;
+use PHPUnit\Framework\Attributes\DataProvider;
use Psr\Http\Message\ResponseInterface;
use Psr\Http\Message\ServerRequestInterface;
use Spiral\Auth\Middleware\Firewall\OverwriteFirewall;
use Spiral\Auth\Transport\HeaderTransport;
-final class OverwriteFirewallTest extends BaseFirewallTest
+final class OverwriteFirewallTest extends BaseFirewallTestCase
{
- /**
- * @dataProvider successTokensDataProvider
- * @dataProvider failTokensDataProvider
- */
+ #[DataProvider('successTokensDataProvider')]
+ #[DataProvider('failTokensDataProvider')]
public function testOverwriteFirewall(string $token): void
{
$http = $this->getCore(
diff --git a/src/AuthHttp/tests/Middleware/Firewall/RedirectFirewallTest.php b/src/AuthHttp/tests/Middleware/Firewall/RedirectFirewallTest.php
index b0981a1f4..6a39411f1 100644
--- a/src/AuthHttp/tests/Middleware/Firewall/RedirectFirewallTest.php
+++ b/src/AuthHttp/tests/Middleware/Firewall/RedirectFirewallTest.php
@@ -7,16 +7,15 @@
use Nyholm\Psr7\Factory\Psr17Factory;
use Nyholm\Psr7\ServerRequest;
use Nyholm\Psr7\Uri;
+use PHPUnit\Framework\Attributes\DataProvider;
use Psr\Http\Message\ResponseInterface;
use Psr\Http\Message\ServerRequestInterface;
use Spiral\Auth\Middleware\Firewall\RedirectFirewall;
use Spiral\Auth\Transport\HeaderTransport;
-final class RedirectFirewallTest extends BaseFirewallTest
+final class RedirectFirewallTest extends BaseFirewallTestCase
{
- /**
- * @dataProvider successTokensDataProvider
- */
+ #[DataProvider('successTokensDataProvider')]
public function testRedirectFirewallWithoutRedirect(string $token): void
{
$http = $this->getCore(
@@ -38,9 +37,7 @@ static function (ServerRequestInterface $request, ResponseInterface $response):
$this->assertSame('success login', (string)$response->getBody());
}
- /**
- * @dataProvider failTokensDataProvider
- */
+ #[DataProvider('failTokensDataProvider')]
public function testRedirectFirewallWithRedirect(string $token): void
{
$http = $this->getCore(
@@ -63,9 +60,7 @@ static function (ServerRequestInterface $request, ResponseInterface $response):
$this->assertSame('', (string) $response->getBody());
}
- /**
- * @dataProvider failTokensDataProvider
- */
+ #[DataProvider('failTokensDataProvider')]
public function testRedirectFirewallWithRedirectAndCode(string $token): void
{
$http = $this->getCore(
diff --git a/src/AuthHttp/tests/TransportRegistryTest.php b/src/AuthHttp/tests/TransportRegistryTest.php
index de70761cd..dae3acef0 100644
--- a/src/AuthHttp/tests/TransportRegistryTest.php
+++ b/src/AuthHttp/tests/TransportRegistryTest.php
@@ -8,7 +8,7 @@
use Spiral\Auth\Transport\CookieTransport;
use Spiral\Auth\TransportRegistry;
-class TransportRegistryTest extends BaseTest
+class TransportRegistryTest extends BaseTestCase
{
public function testGetTransports(): void
{
diff --git a/src/Boot/composer.json b/src/Boot/composer.json
index 420788c24..0fe923dca 100644
--- a/src/Boot/composer.json
+++ b/src/Boot/composer.json
@@ -37,7 +37,7 @@
"spiral/events": "^3.8"
},
"require-dev": {
- "phpunit/phpunit": "^9.5.20",
+ "phpunit/phpunit": "^10.1",
"mockery/mockery": "^1.5",
"vimeo/psalm": "^5.9"
},
diff --git a/src/Boot/tests/BootloadManager/BootloadersTest.php b/src/Boot/tests/BootloadManager/BootloadersTest.php
index a6f975ecd..f0d9e4ba9 100644
--- a/src/Boot/tests/BootloadManager/BootloadersTest.php
+++ b/src/Boot/tests/BootloadManager/BootloadersTest.php
@@ -116,7 +116,7 @@ public function boot(BinderInterface $binder): void
public function testException(): void
{
$this->expectException(\Spiral\Boot\Exception\ClassNotFoundException::class);
- $this->expectErrorMessage('Bootloader class `Foo\Bar\Invalid` is not exist.');
+ $this->expectExceptionMessage('Bootloader class `Foo\Bar\Invalid` is not exist.');
$bootloader = $this->getBootloadManager();
$bootloader->bootload(['Foo\Bar\Invalid']);
diff --git a/src/Boot/tests/Environment/AppEnvironmentTest.php b/src/Boot/tests/Environment/AppEnvironmentTest.php
index 9bbc3f225..551ee2857 100644
--- a/src/Boot/tests/Environment/AppEnvironmentTest.php
+++ b/src/Boot/tests/Environment/AppEnvironmentTest.php
@@ -5,6 +5,7 @@
namespace Spiral\Tests\Boot\Environment;
use Mockery as m;
+use PHPUnit\Framework\Attributes\DataProvider;
use PHPUnit\Framework\TestCase;
use Spiral\Boot\Environment\AppEnvironment;
use Spiral\Boot\EnvironmentInterface;
@@ -22,7 +23,7 @@ public function testDetectWithoutEnvironmentVariable(): void
$this->assertSame(AppEnvironment::Local, $enum);
}
- /** @dataProvider envVariablesDataProvider */
+ #[DataProvider('envVariablesDataProvider')]
public function testDetectWithWrongEnvironmentVariable($name, AppEnvironment $expected): void
{
$env = m::mock(EnvironmentInterface::class);
@@ -34,15 +35,13 @@ public function testDetectWithWrongEnvironmentVariable($name, AppEnvironment $ex
$this->assertSame($expected, $enum);
}
- public function envVariablesDataProvider()
+ public static function envVariablesDataProvider(): \Traversable
{
- return [
- ['wrong', AppEnvironment::Local],
- ['prod', AppEnvironment::Production],
- ['stage', AppEnvironment::Stage],
- ['local', AppEnvironment::Local],
- ['testing', AppEnvironment::Testing]
- ];
+ yield ['wrong', AppEnvironment::Local];
+ yield ['prod', AppEnvironment::Production];
+ yield ['stage', AppEnvironment::Stage];
+ yield ['local', AppEnvironment::Local];
+ yield ['testing', AppEnvironment::Testing];
}
public function testClassMethods(): void
diff --git a/src/Boot/tests/Environment/DebugModeTest.php b/src/Boot/tests/Environment/DebugModeTest.php
index d64c7a90c..989eebe5a 100644
--- a/src/Boot/tests/Environment/DebugModeTest.php
+++ b/src/Boot/tests/Environment/DebugModeTest.php
@@ -5,6 +5,7 @@
namespace Spiral\Tests\Boot\Environment;
use Mockery as m;
+use PHPUnit\Framework\Attributes\DataProvider;
use PHPUnit\Framework\TestCase;
use Spiral\Boot\Environment\DebugMode;
use Spiral\Boot\EnvironmentInterface;
@@ -22,7 +23,7 @@ public function testDetectWithoutEnvironmentVariable(): void
$this->assertSame(DebugMode::Disabled, $enum);
}
- /** @dataProvider envVariablesDataProvider */
+ #[DataProvider('envVariablesDataProvider')]
public function testDetectWithWrongEnvironmentVariable($name, DebugMode $expected): void
{
$env = m::mock(EnvironmentInterface::class);
@@ -40,17 +41,15 @@ public function testDetectWithWrongEnvironmentVariable($name, DebugMode $expecte
}
}
- public function envVariablesDataProvider()
+ public static function envVariablesDataProvider(): \Traversable
{
- return [
- [true, DebugMode::Enabled],
- ['true', DebugMode::Enabled],
- ['1', DebugMode::Enabled],
- ['on', DebugMode::Enabled],
- ['false', DebugMode::Disabled],
- ['0', DebugMode::Disabled],
- ['off', DebugMode::Disabled],
- [false, DebugMode::Disabled],
- ];
+ yield [true, DebugMode::Enabled];
+ yield ['true', DebugMode::Enabled];
+ yield ['1', DebugMode::Enabled];
+ yield ['on', DebugMode::Enabled];
+ yield ['false', DebugMode::Disabled];
+ yield ['0', DebugMode::Disabled];
+ yield ['off', DebugMode::Disabled];
+ yield [false, DebugMode::Disabled];
}
}
diff --git a/src/Boot/tests/Injector/EnumInjectorTest.php b/src/Boot/tests/Injector/EnumInjectorTest.php
index 2f2afd5fc..b91713930 100644
--- a/src/Boot/tests/Injector/EnumInjectorTest.php
+++ b/src/Boot/tests/Injector/EnumInjectorTest.php
@@ -21,7 +21,7 @@ final class EnumInjectorTest extends TestCase
public function testCreateInjectionForClassWithoutAttribute(): void
{
$this->expectException(InjectionException::class);
- $this->expectErrorMessage(
+ $this->expectExceptionMessage(
"Class `Spiral\Tests\Boot\Fixtures\SampleClass` should contain ".
"`Spiral\Boot\Injector\ProvideFrom` attribute with defined detector method."
);
@@ -40,7 +40,7 @@ public function testCreateInjectionNotForClass(): void
$ref = new \ReflectionClass($class);
$this->expectException(InjectionException::class);
- $this->expectErrorMessage(\sprintf('Class `%s` should be an enum.', $ref->getName()));
+ $this->expectExceptionMessage(\sprintf('Class `%s` should be an enum.', $ref->getName()));
$container = new Container();
$injector = new EnumInjector($container, $container, new AttributeReader());
@@ -58,7 +58,7 @@ public function testCreateInjectionNotForEnum(): void
public function testCreateInjectionForClassWithoutMethod(): void
{
$this->expectException(InjectionException::class);
- $this->expectErrorMessage(
+ $this->expectExceptionMessage(
"Class `Spiral\Tests\Boot\Fixtures\InjectableEnumWithoutMethod` does not contain `detect` method."
);
@@ -69,7 +69,7 @@ public function testCreateInjectionForClassWithoutMethod(): void
public function testCreateInjectionForClassWithoutStaticMethod(): void
{
$this->expectException(InjectionException::class);
- $this->expectErrorMessage(
+ $this->expectExceptionMessage(
"Spiral\Tests\Boot\Fixtures\InjectableEnumWithNonStaticMethod::detect` should be static."
);
diff --git a/src/Bridge/Dotenv/composer.json b/src/Bridge/Dotenv/composer.json
index 7b02980be..7f08e95dc 100644
--- a/src/Bridge/Dotenv/composer.json
+++ b/src/Bridge/Dotenv/composer.json
@@ -32,7 +32,7 @@
},
"require-dev": {
"mockery/mockery": "^1.5",
- "phpunit/phpunit": "^9.5.20",
+ "phpunit/phpunit": "^10.1",
"spiral/boot": "^3.8",
"vimeo/psalm": "^5.9"
},
diff --git a/src/Bridge/Monolog/composer.json b/src/Bridge/Monolog/composer.json
index b7681225f..7e9fa7fd3 100644
--- a/src/Bridge/Monolog/composer.json
+++ b/src/Bridge/Monolog/composer.json
@@ -32,7 +32,7 @@
},
"require-dev": {
"spiral/boot": "^3.8",
- "phpunit/phpunit": "^9.5.20",
+ "phpunit/phpunit": "^10.1",
"mockery/mockery": "^1.5",
"vimeo/psalm": "^5.9"
},
diff --git a/src/Bridge/Stempler/composer.json b/src/Bridge/Stempler/composer.json
index 66fc4502f..a31c16a7f 100644
--- a/src/Bridge/Stempler/composer.json
+++ b/src/Bridge/Stempler/composer.json
@@ -37,7 +37,7 @@
},
"require-dev": {
"spiral/boot": "^3.8",
- "phpunit/phpunit": "^9.5.20",
+ "phpunit/phpunit": "^10.1",
"mockery/mockery": "^1.5",
"vimeo/psalm": "^5.9"
},
diff --git a/src/Broadcasting/composer.json b/src/Broadcasting/composer.json
index 7a20ce325..9b29efa79 100644
--- a/src/Broadcasting/composer.json
+++ b/src/Broadcasting/composer.json
@@ -43,7 +43,7 @@
},
"require-dev": {
"mockery/mockery": "^1.5",
- "phpunit/phpunit": "^9.5.20",
+ "phpunit/phpunit": "^10.1",
"spiral/boot": "^3.8",
"vimeo/psalm": "^5.9"
},
diff --git a/src/Broadcasting/tests/Config/BroadcastConfigTest.php b/src/Broadcasting/tests/Config/BroadcastConfigTest.php
index 66bcd221a..e4d44d4b5 100644
--- a/src/Broadcasting/tests/Config/BroadcastConfigTest.php
+++ b/src/Broadcasting/tests/Config/BroadcastConfigTest.php
@@ -78,7 +78,7 @@ public function testGetsConnectionWithAliasDriverShouldBeReplacedWithRealDriver(
public function testNotDefinedConnectionShouldThrowAnException(): void
{
$this->expectException(InvalidArgumentException::class);
- $this->expectErrorMessage('Config for connection `foo` is not defined.');
+ $this->expectExceptionMessage('Config for connection `foo` is not defined.');
$this->config->getConnectionConfig('foo');
}
@@ -86,7 +86,7 @@ public function testNotDefinedConnectionShouldThrowAnException(): void
public function testConnectionWithoutDefinedDriverShouldThrowAnException(): void
{
$this->expectException(InvalidArgumentException::class);
- $this->expectErrorMessage('Driver for `memory` connection is not defined.');
+ $this->expectExceptionMessage('Driver for `memory` connection is not defined.');
$this->config->getConnectionConfig('memory');
}
diff --git a/src/Broadcasting/tests/Middleware/AuthorizationMiddlewareTest.php b/src/Broadcasting/tests/Middleware/AuthorizationMiddlewareTest.php
index ed544f3f4..e4ef2aa39 100644
--- a/src/Broadcasting/tests/Middleware/AuthorizationMiddlewareTest.php
+++ b/src/Broadcasting/tests/Middleware/AuthorizationMiddlewareTest.php
@@ -5,6 +5,7 @@
namespace Spiral\Tests\Broadcasting\Middleware;
use Mockery as m;
+use PHPUnit\Framework\Attributes\DataProvider;
use PHPUnit\Framework\TestCase;
use Psr\EventDispatcher\EventDispatcherInterface;
use Psr\Http\Message\ResponseFactoryInterface;
@@ -143,7 +144,7 @@ public function testGuardedBroadcastWithCustomResponseShouldReturnIt(): void
$this->assertSame($response, $middleware->process($request, $handler));
}
- /** @dataProvider eventsDataProvider */
+ #[DataProvider('eventsDataProvider')]
public function testAuthorizationEventsShouldBeDispatched(string $event, bool $authStatus, int $code): void
{
$request = m::mock(ServerRequestInterface::class);
@@ -199,7 +200,7 @@ public function testAuthorizationEventsWithoutGuardShouldBeDispatched(): void
$middleware->process($request, $handler);
}
- public function eventsDataProvider(): \Traversable
+ public static function eventsDataProvider(): \Traversable
{
yield [Authorized::class, true, 200];
yield [Authorized::class, false, 403];
diff --git a/src/Cache/composer.json b/src/Cache/composer.json
index 72cb5307b..fe425d898 100644
--- a/src/Cache/composer.json
+++ b/src/Cache/composer.json
@@ -42,7 +42,7 @@
"require-dev": {
"spiral/boot": "^3.8",
"mockery/mockery": "^1.5",
- "phpunit/phpunit": "^9.5.20",
+ "phpunit/phpunit": "^10.1",
"vimeo/psalm": "^5.9"
},
"autoload-dev": {
diff --git a/src/Cache/tests/CacheManagerTest.php b/src/Cache/tests/CacheManagerTest.php
index f8444b80d..928f553f1 100644
--- a/src/Cache/tests/CacheManagerTest.php
+++ b/src/Cache/tests/CacheManagerTest.php
@@ -6,6 +6,7 @@
use Mockery as m;
use Mockery\Adapter\Phpunit\MockeryPHPUnitIntegration;
+use PHPUnit\Framework\Attributes\DataProvider;
use PHPUnit\Framework\TestCase;
use Psr\EventDispatcher\EventDispatcherInterface;
use Psr\SimpleCache\CacheInterface;
@@ -149,9 +150,7 @@ public function testStorageShouldBeCreatedOnlyOnceWithDifferentPrefixes(): void
$this->assertSame('news_', (new \ReflectionProperty($news, 'prefix'))->getValue($news));
}
- /**
- * @dataProvider prefixesDataProvider
- */
+ #[DataProvider('prefixesDataProvider')]
public function testGetStorageByAliasWithPrefix(string $alias, ?string $expectedPrefix): void
{
$storage = m::mock(CacheInterface::class);
@@ -212,7 +211,7 @@ public function testCacheRepositoryWithEventDispatcher(): void
);
}
- public function prefixesDataProvider(): \Traversable
+ public static function prefixesDataProvider(): \Traversable
{
yield ['blog-data', 'blog_'];
yield ['store-data', null];
diff --git a/src/Cache/tests/CacheRepositoryTest.php b/src/Cache/tests/CacheRepositoryTest.php
index 565c3537f..639dfe73d 100644
--- a/src/Cache/tests/CacheRepositoryTest.php
+++ b/src/Cache/tests/CacheRepositoryTest.php
@@ -4,6 +4,7 @@
namespace Spiral\Tests\Cache;
+use PHPUnit\Framework\Attributes\DataProvider;
use PHPUnit\Framework\TestCase;
use Psr\EventDispatcher\EventDispatcherInterface;
use Psr\SimpleCache\CacheInterface;
@@ -119,9 +120,7 @@ public function testKeyDeletedEventShouldBeDispatchedInMultiple(): void
$repository->deleteMultiple(['test', 'test2']);
}
- /**
- * @dataProvider keysDataProvider
- */
+ #[DataProvider('keysDataProvider')]
public function testGet(string $expectedKey, ?string $prefix = null): void
{
$storage = $this->createMock(CacheInterface::class);
@@ -136,9 +135,7 @@ public function testGet(string $expectedKey, ?string $prefix = null): void
$repository->get('data');
}
- /**
- * @dataProvider keysDataProvider
- */
+ #[DataProvider('keysDataProvider')]
public function testSet(string $expectedKey, ?string $prefix = null): void
{
$storage = $this->createMock(CacheInterface::class);
@@ -153,9 +150,7 @@ public function testSet(string $expectedKey, ?string $prefix = null): void
$repository->set('data', 'foo');
}
- /**
- * @dataProvider keysDataProvider
- */
+ #[DataProvider('keysDataProvider')]
public function testDelete(string $expectedKey, ?string $prefix = null): void
{
$storage = $this->createMock(CacheInterface::class);
@@ -170,9 +165,7 @@ public function testDelete(string $expectedKey, ?string $prefix = null): void
$repository->delete('data');
}
- /**
- * @dataProvider keysDataProvider
- */
+ #[DataProvider('keysDataProvider')]
public function testGetMultiple(string $expectedKey, ?string $prefix = null): void
{
$storage = $this->createMock(CacheInterface::class);
@@ -187,9 +180,7 @@ public function testGetMultiple(string $expectedKey, ?string $prefix = null): vo
$repository->getMultiple(['data']);
}
- /**
- * @dataProvider keysDataProvider
- */
+ #[DataProvider('keysDataProvider')]
public function testSetMultiple(string $expectedKey, ?string $prefix = null): void
{
$storage = $this->createMock(CacheInterface::class);
@@ -204,9 +195,7 @@ public function testSetMultiple(string $expectedKey, ?string $prefix = null): vo
$repository->setMultiple(['data' => 'foo']);
}
- /**
- * @dataProvider keysDataProvider
- */
+ #[DataProvider('keysDataProvider')]
public function testDeleteMultiple(string $expectedKey, ?string $prefix = null): void
{
$storage = $this->createMock(CacheInterface::class);
@@ -221,9 +210,7 @@ public function testDeleteMultiple(string $expectedKey, ?string $prefix = null):
$repository->deleteMultiple(['data']);
}
- /**
- * @dataProvider keysDataProvider
- */
+ #[DataProvider('keysDataProvider')]
public function testHas(string $expectedKey, ?string $prefix = null): void
{
$storage = $this->createMock(CacheInterface::class);
@@ -238,7 +225,7 @@ public function testHas(string $expectedKey, ?string $prefix = null): void
$repository->has('data');
}
- public function keysDataProvider(): \Traversable
+ public static function keysDataProvider(): \Traversable
{
yield ['data'];
yield ['data', ''];
diff --git a/src/Cache/tests/Config/CacheConfigTest.php b/src/Cache/tests/Config/CacheConfigTest.php
index f0100da9f..edd46158f 100644
--- a/src/Cache/tests/Config/CacheConfigTest.php
+++ b/src/Cache/tests/Config/CacheConfigTest.php
@@ -73,7 +73,7 @@ public function testGetsStorageWithAliasTypeShouldBeReplacedWithRealType(): void
public function testNotDefinedStorageShouldThrowAnException(): void
{
$this->expectException(InvalidArgumentException::class);
- $this->expectErrorMessage('Config for storage `foo` is not defined.');
+ $this->expectExceptionMessage('Config for storage `foo` is not defined.');
$this->config->getStorageConfig('foo');
}
@@ -81,7 +81,7 @@ public function testNotDefinedStorageShouldThrowAnException(): void
public function testStorageWithoutDefinedTypeShouldThrowAnException(): void
{
$this->expectException(InvalidArgumentException::class);
- $this->expectErrorMessage('Storage type for `memory` is not defined.');
+ $this->expectExceptionMessage('Storage type for `memory` is not defined.');
$this->config->getStorageConfig('memory');
}
diff --git a/src/Config/composer.json b/src/Config/composer.json
index d63072840..a1977ec86 100644
--- a/src/Config/composer.json
+++ b/src/Config/composer.json
@@ -32,7 +32,7 @@
"spiral/core": "^3.8"
},
"require-dev": {
- "phpunit/phpunit": "^9.5.20",
+ "phpunit/phpunit": "^10.1",
"mockery/mockery": "^1.5",
"vimeo/psalm": "^5.9"
},
diff --git a/src/Config/tests/AppendTest.php b/src/Config/tests/AppendTest.php
index ed2925090..ea877b116 100644
--- a/src/Config/tests/AppendTest.php
+++ b/src/Config/tests/AppendTest.php
@@ -7,7 +7,7 @@
use Spiral\Config\Exception\PatchException;
use Spiral\Config\Patch\Append;
-class AppendTest extends BaseTest
+class AppendTest extends BaseTestCase
{
public function testPatch(): void
{
diff --git a/src/Config/tests/BaseTest.php b/src/Config/tests/BaseTestCase.php
similarity index 95%
rename from src/Config/tests/BaseTest.php
rename to src/Config/tests/BaseTestCase.php
index e1fc32a6b..884c4c569 100644
--- a/src/Config/tests/BaseTest.php
+++ b/src/Config/tests/BaseTestCase.php
@@ -11,7 +11,7 @@
use Spiral\Config\Loader\PhpLoader;
use Spiral\Core\Container;
-abstract class BaseTest extends TestCase
+abstract class BaseTestCase extends TestCase
{
/**
* @var Container
diff --git a/src/Config/tests/ConfigFactoryTest.php b/src/Config/tests/ConfigFactoryTest.php
index bdddff745..f5acd221f 100644
--- a/src/Config/tests/ConfigFactoryTest.php
+++ b/src/Config/tests/ConfigFactoryTest.php
@@ -7,7 +7,7 @@
use Spiral\Config\Exception\LoaderException;
use Spiral\Core\Container\Autowire;
-class ConfigFactoryTest extends BaseTest
+class ConfigFactoryTest extends BaseTestCase
{
public function testGetConfig(): void
{
diff --git a/src/Config/tests/DefaultsTest.php b/src/Config/tests/DefaultsTest.php
index a053ea29c..aded3ef24 100644
--- a/src/Config/tests/DefaultsTest.php
+++ b/src/Config/tests/DefaultsTest.php
@@ -7,7 +7,7 @@
use Spiral\Core\Container\Autowire;
use Spiral\Core\Exception\ConfiguratorException;
-class DefaultsTest extends BaseTest
+class DefaultsTest extends BaseTestCase
{
public function testGetNonExistedByDefaultConfig(): void
{
diff --git a/src/Config/tests/DeleteTest.php b/src/Config/tests/DeleteTest.php
index a95faacfb..555703ed1 100644
--- a/src/Config/tests/DeleteTest.php
+++ b/src/Config/tests/DeleteTest.php
@@ -7,7 +7,7 @@
use Spiral\Config\Patch\Append;
use Spiral\Config\Patch\Delete;
-class DeleteTest extends BaseTest
+class DeleteTest extends BaseTestCase
{
public function testPatch(): void
{
diff --git a/src/Config/tests/GroupTest.php b/src/Config/tests/GroupTest.php
index b08db9207..050a7e298 100644
--- a/src/Config/tests/GroupTest.php
+++ b/src/Config/tests/GroupTest.php
@@ -9,7 +9,7 @@
use Spiral\Config\Patch\Group;
use Spiral\Config\Patch\Prepend;
-class GroupTest extends BaseTest
+class GroupTest extends BaseTestCase
{
public function testPatch(): void
{
diff --git a/src/Config/tests/InjectionTest.php b/src/Config/tests/InjectionTest.php
index 2a12a510f..2bbdaf7f5 100644
--- a/src/Config/tests/InjectionTest.php
+++ b/src/Config/tests/InjectionTest.php
@@ -8,9 +8,8 @@
use Spiral\Config\Patch\Append;
use Spiral\Core\ConfigsInterface;
use Spiral\Core\Container\Autowire;
-use Spiral\Core\InjectableConfig;
-class InjectionTest extends BaseTest
+class InjectionTest extends BaseTestCase
{
public function testInjection(): void
{
diff --git a/src/Config/tests/JsonLoaderTest.php b/src/Config/tests/JsonLoaderTest.php
index af83507ee..5e8266493 100644
--- a/src/Config/tests/JsonLoaderTest.php
+++ b/src/Config/tests/JsonLoaderTest.php
@@ -6,7 +6,7 @@
use Spiral\Config\Exception\LoaderException;
-class JsonLoaderTest extends BaseTest
+class JsonLoaderTest extends BaseTestCase
{
public function testGetConfig(): void
{
diff --git a/src/Config/tests/PhpLoaderTest.php b/src/Config/tests/PhpLoaderTest.php
index e29dbf97d..b13a34a1c 100644
--- a/src/Config/tests/PhpLoaderTest.php
+++ b/src/Config/tests/PhpLoaderTest.php
@@ -7,7 +7,7 @@
use Spiral\Config\Exception\LoaderException;
use Spiral\Core\Container\Autowire;
-class PhpLoaderTest extends BaseTest
+class PhpLoaderTest extends BaseTestCase
{
public function testGetConfig(): void
{
diff --git a/src/Config/tests/PrependTest.php b/src/Config/tests/PrependTest.php
index 7e91a3876..0ba913981 100644
--- a/src/Config/tests/PrependTest.php
+++ b/src/Config/tests/PrependTest.php
@@ -7,7 +7,7 @@
use Spiral\Config\Exception\PatchException;
use Spiral\Config\Patch\Prepend;
-class PrependTest extends BaseTest
+class PrependTest extends BaseTestCase
{
public function testPatch(): void
{
diff --git a/src/Config/tests/SetTest.php b/src/Config/tests/SetTest.php
index b4711c392..f12d91cba 100644
--- a/src/Config/tests/SetTest.php
+++ b/src/Config/tests/SetTest.php
@@ -6,7 +6,7 @@
use Spiral\Config\Patch\Set;
-class SetTest extends BaseTest
+class SetTest extends BaseTestCase
{
public function testPatch(): void
{
diff --git a/src/Console/composer.json b/src/Console/composer.json
index efe93d4ee..e098e1380 100644
--- a/src/Console/composer.json
+++ b/src/Console/composer.json
@@ -36,7 +36,7 @@
},
"require-dev": {
"spiral/boot": "^3.8",
- "phpunit/phpunit": "^9.5.20",
+ "phpunit/phpunit": "^10.1",
"mockery/mockery": "^1.5",
"vimeo/psalm": "^5.9"
},
diff --git a/src/Console/tests/AttributeTest.php b/src/Console/tests/AttributeTest.php
index 8f42c972d..634947286 100644
--- a/src/Console/tests/AttributeTest.php
+++ b/src/Console/tests/AttributeTest.php
@@ -11,7 +11,7 @@
use Spiral\Tests\Console\Fixtures\Attribute\WithNameCommand;
use Spiral\Tests\Console\Fixtures\Attribute\WithSymfonyAttributeCommand;
-final class AttributeTest extends BaseTest
+final class AttributeTest extends BaseTestCase
{
public function setUp(): void
{
diff --git a/src/Console/tests/BaseTest.php b/src/Console/tests/BaseTestCase.php
similarity index 97%
rename from src/Console/tests/BaseTest.php
rename to src/Console/tests/BaseTestCase.php
index a8957730b..afc86f61a 100644
--- a/src/Console/tests/BaseTest.php
+++ b/src/Console/tests/BaseTestCase.php
@@ -15,7 +15,7 @@
use Spiral\Core\Container;
use Spiral\Tokenizer\ScopedClassesInterface;
-abstract class BaseTest extends TestCase
+abstract class BaseTestCase extends TestCase
{
public const TOKENIZER_CONFIG = [
'directories' => [__DIR__ . '/Fixtures/'],
diff --git a/src/Console/tests/ConfigureTest.php b/src/Console/tests/ConfigureTest.php
index b57f8d2fd..c3dee7cfe 100644
--- a/src/Console/tests/ConfigureTest.php
+++ b/src/Console/tests/ConfigureTest.php
@@ -11,10 +11,11 @@
use Spiral\Tests\Console\Fixtures\FailedCommand;
use Spiral\Tests\Console\Fixtures\HelperCommand;
use Spiral\Tests\Console\Fixtures\TestCommand;
+use Spiral\Tests\Console\Fixtures\UpdateClass;
use Symfony\Component\Console\Output\OutputInterface;
use Throwable;
-class ConfigureTest extends BaseTest
+class ConfigureTest extends BaseTestCase
{
public const TOKENIZER_CONFIG = [
'directories' => [__DIR__.'/../src/Command', __DIR__.'/Fixtures/'],
@@ -27,10 +28,10 @@ class ConfigureTest extends BaseTest
'configure' => [
['command' => 'test', 'header' => 'Test Command'],
['command' => 'helper', 'options' => ['helper' => 'writeln'], 'footer' => 'Good!'],
- ['invoke' => [self::class, 'do']],
- ['invoke' => self::class.'::do'],
+ ['invoke' => [UpdateClass::class, 'do']],
+ ['invoke' => UpdateClass::class.'::do'],
'Spiral\Tests\Console\ok',
- ['invoke' => self::class.'::err'],
+ ['invoke' => UpdateClass::class.'::err'],
],
],
];
@@ -124,16 +125,6 @@ public function testNoBreakFailure(): void
$this->assertEquals(1, $output->getCode());
}
- public function do(OutputInterface $output): void
- {
- $output->write('OK');
- }
-
- public function err(OutputInterface $output): void
- {
- throw new ShortException('Failed configure command');
- }
-
/**
* @return Console
*/
diff --git a/src/Console/tests/CoreTest.php b/src/Console/tests/CoreTest.php
index ff0de035d..dfa38f8c1 100644
--- a/src/Console/tests/CoreTest.php
+++ b/src/Console/tests/CoreTest.php
@@ -8,7 +8,7 @@
use Symfony\Component\Console\Input\ArrayInput;
use Symfony\Component\Console\Output\BufferedOutput;
-class CoreTest extends BaseTest
+class CoreTest extends BaseTestCase
{
public function testWelcome(): void
{
diff --git a/src/Console/tests/EventsTest.php b/src/Console/tests/EventsTest.php
index 1dde18ba1..569e2744e 100644
--- a/src/Console/tests/EventsTest.php
+++ b/src/Console/tests/EventsTest.php
@@ -10,29 +10,20 @@
use Spiral\Core\Event\InterceptorCalling;
use Spiral\Tests\Console\Fixtures\TestCommand;
-final class EventsTest extends BaseTest
+final class EventsTest extends BaseTestCase
{
public function testEventsShouldBeDispatched(): void
{
- $dispatcher = $this->createMock(EventDispatcherInterface::class);
-
- $dispatcher->expects(self::exactly(3))
- ->method('dispatch')
- ->withConsecutive(
- [
- $this->callback(static fn(mixed $event): bool =>
- $event instanceof CommandStarting && $event->command instanceof TestCommand
- )
- ],
- [
- $this->callback(static fn(mixed $event): bool => $event instanceof InterceptorCalling)
- ],
- [
- $this->callback(static fn(mixed $event): bool =>
- $event instanceof CommandFinished && $event->command instanceof TestCommand
- )
- ],
- );
+ $dispatcher = \Mockery::mock(EventDispatcherInterface::class);
+ $dispatcher
+ ->shouldReceive('dispatch')
+ ->with(\Mockery::type(CommandStarting::class));
+ $dispatcher
+ ->shouldReceive('dispatch')
+ ->with(\Mockery::type(InterceptorCalling::class));
+ $dispatcher
+ ->shouldReceive('dispatch')
+ ->with(\Mockery::type(CommandFinished::class));
$core = $this->getCore(
locator: $this->getStaticLocator([new TestCommand()]),
@@ -40,5 +31,7 @@ public function testEventsShouldBeDispatched(): void
);
$core->run('test');
+
+ $this->assertTrue(true);
}
}
diff --git a/src/Console/tests/Fixtures/UpdateClass.php b/src/Console/tests/Fixtures/UpdateClass.php
new file mode 100644
index 000000000..8dae6c73b
--- /dev/null
+++ b/src/Console/tests/Fixtures/UpdateClass.php
@@ -0,0 +1,21 @@
+write('OK');
+ }
+
+ public function err(OutputInterface $output): void
+ {
+ throw new ShortException('Failed configure command');
+ }
+}
diff --git a/src/Console/tests/HelpersTest.php b/src/Console/tests/HelpersTest.php
index dcc022b8e..0949d5987 100644
--- a/src/Console/tests/HelpersTest.php
+++ b/src/Console/tests/HelpersTest.php
@@ -8,7 +8,7 @@
use Symfony\Component\Console\Output\BufferedOutput;
use Symfony\Component\Console\Output\OutputInterface;
-class HelpersTest extends BaseTest
+class HelpersTest extends BaseTestCase
{
private \Spiral\Console\Console $core;
@@ -26,7 +26,7 @@ public function testVerbose(): void
$actual = $this->core->run('helper', ['helper' => 'verbose'])
->getOutput()
->fetch();
-
+
$this->assertSame('false', $actual);
$output = new BufferedOutput();
diff --git a/src/Console/tests/InterceptorTest.php b/src/Console/tests/InterceptorTest.php
index 031ac6342..0678e896a 100644
--- a/src/Console/tests/InterceptorTest.php
+++ b/src/Console/tests/InterceptorTest.php
@@ -11,7 +11,7 @@
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;
-final class InterceptorTest extends BaseTest
+final class InterceptorTest extends BaseTestCase
{
use MockeryPHPUnitIntegration;
diff --git a/src/Console/tests/LazyTest.php b/src/Console/tests/LazyTest.php
index 9b32999c6..6ae600706 100644
--- a/src/Console/tests/LazyTest.php
+++ b/src/Console/tests/LazyTest.php
@@ -4,12 +4,11 @@
namespace Spiral\Tests\Console;
-use Spiral\Console\CommandLocator;
use Spiral\Tests\Console\Fixtures\LazyLoadedCommand;
use Spiral\Tokenizer\ScopedClassesInterface;
use Symfony\Component\Console\Command\LazyCommand;
-class LazyTest extends BaseTest
+class LazyTest extends BaseTestCase
{
public function testLazyCommandCreationInCommandLocator(): void
{
diff --git a/src/Console/tests/OptionsTest.php b/src/Console/tests/OptionsTest.php
index e98dd65c5..d07e6c9e0 100644
--- a/src/Console/tests/OptionsTest.php
+++ b/src/Console/tests/OptionsTest.php
@@ -6,7 +6,7 @@
use Spiral\Tests\Console\Fixtures\OptionalCommand;
-class OptionsTest extends BaseTest
+class OptionsTest extends BaseTestCase
{
public function testOptions(): void
{
diff --git a/src/Console/tests/PromptArgumentsTest.php b/src/Console/tests/PromptArgumentsTest.php
index f13761ca9..184e9c296 100644
--- a/src/Console/tests/PromptArgumentsTest.php
+++ b/src/Console/tests/PromptArgumentsTest.php
@@ -15,7 +15,7 @@
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;
-final class PromptArgumentsTest extends BaseTest
+final class PromptArgumentsTest extends BaseTestCase
{
public function testCommandArgumentShouldBeSkipped(): void
{
diff --git a/src/Console/tests/SignatureTest.php b/src/Console/tests/SignatureTest.php
index 6d5c88170..4b10f434a 100644
--- a/src/Console/tests/SignatureTest.php
+++ b/src/Console/tests/SignatureTest.php
@@ -7,7 +7,7 @@
use Spiral\Console\Command;
use Symfony\Component\Console\Input\StringInput;
-final class SignatureTest extends BaseTest
+final class SignatureTest extends BaseTestCase
{
public function testOptions(): void
{
diff --git a/src/Console/tests/UpdateTest.php b/src/Console/tests/UpdateTest.php
index 824612267..254558f78 100644
--- a/src/Console/tests/UpdateTest.php
+++ b/src/Console/tests/UpdateTest.php
@@ -11,10 +11,10 @@
use Spiral\Tests\Console\Fixtures\FailedCommand;
use Spiral\Tests\Console\Fixtures\HelperCommand;
use Spiral\Tests\Console\Fixtures\TestCommand;
-use Symfony\Component\Console\Output\OutputInterface;
+use Spiral\Tests\Console\Fixtures\UpdateClass;
use Throwable;
-class UpdateTest extends BaseTest
+class UpdateTest extends BaseTestCase
{
public const TOKENIZER_CONFIG = [
'directories' => [__DIR__.'/../src/Command', __DIR__.'/Fixtures/'],
@@ -28,10 +28,10 @@ class UpdateTest extends BaseTest
'update' => [
['command' => 'test', 'header' => 'Test Command'],
['command' => 'helper', 'options' => ['helper' => 'writeln'], 'footer' => 'Good!'],
- ['invoke' => [self::class, 'do']],
- ['invoke' => self::class.'::do'],
+ ['invoke' => [UpdateClass::class, 'do']],
+ ['invoke' => UpdateClass::class.'::do'],
'Spiral\Tests\Console\ok',
- ['invoke' => self::class.'::err'],
+ ['invoke' => UpdateClass::class.'::err'],
],
],
];
@@ -122,16 +122,6 @@ public function testNoBreakFailure(): void
$this->assertEquals(1, $output->getCode());
}
- public function do(OutputInterface $output): void
- {
- $output->write('OK');
- }
-
- public function err(OutputInterface $output): void
- {
- throw new ShortException('Failed update command');
- }
-
/**
* @return Console
*/
diff --git a/src/Cookies/composer.json b/src/Cookies/composer.json
index d359879c0..baaa87819 100644
--- a/src/Cookies/composer.json
+++ b/src/Cookies/composer.json
@@ -33,7 +33,7 @@
"psr/http-server-middleware": "^1.0"
},
"require-dev": {
- "phpunit/phpunit": "^9.5.20",
+ "phpunit/phpunit": "^10.1",
"mockery/mockery": "^1.5",
"spiral/http": "^3.8",
"nyholm/psr7": "^1.5",
diff --git a/src/Cookies/tests/CookieTest.php b/src/Cookies/tests/CookieTest.php
index b8148a170..af3923eea 100644
--- a/src/Cookies/tests/CookieTest.php
+++ b/src/Cookies/tests/CookieTest.php
@@ -4,6 +4,7 @@
namespace Spiral\Tests\Cookies;
+use PHPUnit\Framework\Attributes\DataProvider;
use PHPUnit\Framework\TestCase;
use Spiral\Cookies\Cookie;
@@ -109,13 +110,8 @@ public function testPack(): void
);
}
- /**
- * @dataProvider sameSiteProvider
- * @param $expected
- * @param bool $secure
- * @param string|null $sameSite
- */
- public function testSameSite($expected, bool $secure, ?string $sameSite): void
+ #[DataProvider('sameSiteProvider')]
+ public function testSameSite(?string $expected, bool $secure, ?string $sameSite): void
{
$cookie = new Cookie('', '', 0, '', '', $secure, false, $sameSite);
$this->assertSame($expected, $cookie->getSameSite());
@@ -127,22 +123,17 @@ public function testSameSite($expected, bool $secure, ?string $sameSite): void
}
}
- /**
- * @return iterable
- */
- public function sameSiteProvider(): iterable
+ public static function sameSiteProvider(): \Traversable
{
- return [
- [null, true, null],
- [null, false, null],
- [null, true, 'weird'],
- [null, false, 'weird'],
- ['Lax', true, 'lax'],
- ['Lax', false, 'lax'],
- ['Strict', true, 'strict'],
- ['Strict', false, 'strict'],
- ['None', true, 'none'],
- ['Lax', false, 'none'],
- ];
+ yield [null, true, null];
+ yield [null, false, null];
+ yield [null, true, 'weird'];
+ yield [null, false, 'weird'];
+ yield ['Lax', true, 'lax'];
+ yield ['Lax', false, 'lax'];
+ yield ['Strict', true, 'strict'];
+ yield ['Strict', false, 'strict'];
+ yield ['None', true, 'none'];
+ yield ['Lax', false, 'none'];
}
}
diff --git a/src/Core/composer.json b/src/Core/composer.json
index 6ce71a977..289815fd4 100644
--- a/src/Core/composer.json
+++ b/src/Core/composer.json
@@ -32,7 +32,7 @@
},
"require-dev": {
"mockery/mockery": "^1.5",
- "phpunit/phpunit": "^9.5.20",
+ "phpunit/phpunit": "^10.1",
"vimeo/psalm": "^5.9"
},
"autoload": {
diff --git a/src/Core/tests/BindingsTest.php b/src/Core/tests/BindingsTest.php
index 8225c810a..e1973e636 100644
--- a/src/Core/tests/BindingsTest.php
+++ b/src/Core/tests/BindingsTest.php
@@ -7,6 +7,7 @@
use PHPUnit\Framework\TestCase;
use Psr\Container\ContainerInterface;
use Spiral\Core\Container;
+use Spiral\Tests\Core\Fixtures\Factory;
use Spiral\Tests\Core\Fixtures\SampleClass;
class BindingsTest extends TestCase
@@ -57,7 +58,7 @@ public function testFactoryBinding(): void
{
$container = new Container();
- $container->bindSingleton('sampleClass', [self::class, 'sampleClass']);
+ $container->bindSingleton('sampleClass', [Factory::class, 'sampleClass']);
$this->assertInstanceOf(SampleClass::class, $container->get('sampleClass'));
}
@@ -72,12 +73,4 @@ public function testInstanceBinding(): void
$this->assertInstanceOf(SampleClass::class, $instance);
$this->assertSame($instance, $container->get('sampleClass'));
}
-
- /**
- * @return SampleClass
- */
- public function sampleClass()
- {
- return new SampleClass();
- }
}
diff --git a/src/Core/tests/ExceptionsTest.php b/src/Core/tests/ExceptionsTest.php
index 38ce2b694..830429319 100644
--- a/src/Core/tests/ExceptionsTest.php
+++ b/src/Core/tests/ExceptionsTest.php
@@ -4,6 +4,7 @@
namespace Spiral\Tests\Core;
+use PHPUnit\Framework\Attributes\DataProvider;
use PHPUnit\Framework\TestCase;
use Psr\Container\ContainerExceptionInterface;
use Psr\Container\ContainerInterface;
@@ -162,9 +163,7 @@ public function testOldTraceShouldBeCleared(): void
$container->get('invalid-other');
}
- /**
- * @dataProvider exceptionTraceDataProvider
- */
+ #[DataProvider('exceptionTraceDataProvider')]
public function testExceptionTrace(Container $container, string $message): void
{
$this->expectException(ContainerException::class);
@@ -173,7 +172,7 @@ public function testExceptionTrace(Container $container, string $message): void
$container->get(ClassWithUndefinedDependency::class);
}
- public function exceptionTraceDataProvider(): \Traversable
+ public static function exceptionTraceDataProvider(): \Traversable
{
$binding = new Container();
$binding->bind('Spiral\Tests\Core\Fixtures\InvalidClass', ['invalid']);
diff --git a/src/Core/tests/Fixtures/Factory.php b/src/Core/tests/Fixtures/Factory.php
new file mode 100644
index 000000000..0c911f739
--- /dev/null
+++ b/src/Core/tests/Fixtures/Factory.php
@@ -0,0 +1,33 @@
+assertTrue($container->hasInjector(InjectableClassImplementation::class));
}
- public function inheritanceDataProvider(): iterable
+ public static function inheritanceDataProvider(): iterable
{
yield 'parent' => [InjectableClassInterface::class];
yield 'child' => [InjectableClassChildInterface::class];
@@ -180,9 +181,7 @@ public function inheritanceDataProvider(): iterable
yield 'child-impl' => [InjectableClassChildImplementation::class];
}
- /**
- * @dataProvider inheritanceDataProvider
- */
+ #[DataProvider('inheritanceDataProvider')]
public function testInjectableInheritance(string $class): void
{
$mock = $this->createMock(Container\InjectorInterface::class);
diff --git a/src/Core/tests/Internal/BaseTest.php b/src/Core/tests/Internal/BaseTestCase.php
similarity index 97%
rename from src/Core/tests/Internal/BaseTest.php
rename to src/Core/tests/Internal/BaseTestCase.php
index 07a7049a4..3b099c147 100644
--- a/src/Core/tests/Internal/BaseTest.php
+++ b/src/Core/tests/Internal/BaseTestCase.php
@@ -16,7 +16,7 @@
use Spiral\Core\Internal\State;
use Spiral\Core\ResolverInterface;
-abstract class BaseTest extends TestCase
+abstract class BaseTestCase extends TestCase
{
protected Registry $constructor;
protected Config $config;
diff --git a/src/Core/tests/Internal/Container/BaseTest.php b/src/Core/tests/Internal/Container/BaseTestCase.php
similarity index 96%
rename from src/Core/tests/Internal/Container/BaseTest.php
rename to src/Core/tests/Internal/Container/BaseTestCase.php
index 6485905d4..3afa3bdd8 100644
--- a/src/Core/tests/Internal/Container/BaseTest.php
+++ b/src/Core/tests/Internal/Container/BaseTestCase.php
@@ -13,7 +13,7 @@
use Spiral\Core\Internal\Scope;
use Spiral\Core\Internal\State;
-abstract class BaseTest extends TestCase
+abstract class BaseTestCase extends TestCase
{
protected Registry $constructor;
protected Config $config;
diff --git a/src/Core/tests/Internal/Container/WeakReferenceTest.php b/src/Core/tests/Internal/Container/WeakReferenceTest.php
index c420bf68d..90bcf6df3 100644
--- a/src/Core/tests/Internal/Container/WeakReferenceTest.php
+++ b/src/Core/tests/Internal/Container/WeakReferenceTest.php
@@ -7,7 +7,7 @@
use stdClass;
use WeakReference;
-final class WeakReferenceTest extends BaseTest
+final class WeakReferenceTest extends BaseTestCase
{
public function testAliasNotClassName(): void
{
diff --git a/src/Core/tests/Internal/Factory/BaseTest.php b/src/Core/tests/Internal/Factory/BaseTestCase.php
similarity index 77%
rename from src/Core/tests/Internal/Factory/BaseTest.php
rename to src/Core/tests/Internal/Factory/BaseTestCase.php
index 5b39379e4..88b4e0231 100644
--- a/src/Core/tests/Internal/Factory/BaseTest.php
+++ b/src/Core/tests/Internal/Factory/BaseTestCase.php
@@ -4,7 +4,7 @@
namespace Spiral\Tests\Core\Internal\Factory;
-abstract class BaseTest extends \Spiral\Tests\Core\Internal\BaseTest
+abstract class BaseTestCase extends \Spiral\Tests\Core\Internal\BaseTestCase
{
protected function make(string $class, array $args = [], string $context = null): mixed
{
diff --git a/src/Core/tests/Internal/Factory/CommonCasesTest.php b/src/Core/tests/Internal/Factory/CommonCasesTest.php
index 1dc7576b3..4a508a497 100644
--- a/src/Core/tests/Internal/Factory/CommonCasesTest.php
+++ b/src/Core/tests/Internal/Factory/CommonCasesTest.php
@@ -10,11 +10,12 @@
use Spiral\Tests\Core\Fixtures\Bucket;
use Spiral\Tests\Core\Fixtures\CorruptedClass;
use Spiral\Tests\Core\Fixtures\DatetimeInjector;
+use Spiral\Tests\Core\Fixtures\Factory;
use Spiral\Tests\Core\Fixtures\SampleClass;
use Spiral\Tests\Core\Stub\EnumService;
use Spiral\Tests\Core\Stub\LightEngineDecorator;
-final class CommonCasesTest extends BaseTest
+final class CommonCasesTest extends BaseTestCase
{
public function testNotInstantiableEnum(): void
{
@@ -111,7 +112,7 @@ public function testMakeInterfaceWithDefinition(): void
public function testPrivateMethodFactory(): void
{
- $this->bind(Bucket::class, [self::class, 'makeBucket']);
+ $this->bind(Bucket::class, [Factory::class, 'makeBucket']);
$bucket = $this->make(Bucket::class, [
'data' => 'some data',
@@ -126,7 +127,7 @@ public function testCascadeFactory(): void
{
$sample = new SampleClass();
- $this->bind(Bucket::class, [self::class, 'makeBucketWithSample']);
+ $this->bind(Bucket::class, [Factory::class, 'makeBucketWithSample']);
$this->bind(SampleClass::class, function () use ($sample) {
return $sample;
});
@@ -137,24 +138,4 @@ public function testCascadeFactory(): void
$this->assertSame('via-method-with-sample', $bucket->getName());
$this->assertSame($sample, $bucket->getData());
}
-
- /**
- * @param mixed $data
- *
- * @return Bucket
- */
- private function makeBucket($data)
- {
- return new Bucket('via-method', $data);
- }
-
- /**
- * @param SampleClass $sample
- *
- * @return Bucket
- */
- private function makeBucketWithSample(SampleClass $sample)
- {
- return new Bucket('via-method-with-sample', $sample);
- }
}
diff --git a/src/Core/tests/Internal/Resolver/BaseTest.php b/src/Core/tests/Internal/Resolver/BaseTestCase.php
similarity index 89%
rename from src/Core/tests/Internal/Resolver/BaseTest.php
rename to src/Core/tests/Internal/Resolver/BaseTestCase.php
index ea451864b..91d127b31 100644
--- a/src/Core/tests/Internal/Resolver/BaseTest.php
+++ b/src/Core/tests/Internal/Resolver/BaseTestCase.php
@@ -4,7 +4,7 @@
namespace Spiral\Tests\Core\Internal\Resolver;
-abstract class BaseTest extends \Spiral\Tests\Core\Internal\BaseTest
+abstract class BaseTestCase extends \Spiral\Tests\Core\Internal\BaseTestCase
{
protected function resolveClassConstructor(string $class, array $args = []): mixed
{
diff --git a/src/Core/tests/Internal/Resolver/CommonCasesTest.php b/src/Core/tests/Internal/Resolver/CommonCasesTest.php
index 407e824f0..3fa5b8313 100644
--- a/src/Core/tests/Internal/Resolver/CommonCasesTest.php
+++ b/src/Core/tests/Internal/Resolver/CommonCasesTest.php
@@ -13,7 +13,7 @@
use Spiral\Tests\Core\Stub\TestTrait;
use stdClass;
-final class CommonCasesTest extends BaseTest
+final class CommonCasesTest extends BaseTestCase
{
public function testEmptySignature(): void
{
diff --git a/src/Core/tests/Internal/Resolver/ExceptionsTest.php b/src/Core/tests/Internal/Resolver/ExceptionsTest.php
index c10be28e5..202e5437f 100644
--- a/src/Core/tests/Internal/Resolver/ExceptionsTest.php
+++ b/src/Core/tests/Internal/Resolver/ExceptionsTest.php
@@ -10,7 +10,7 @@
use Spiral\Tests\Core\Stub\EngineInterface;
use Spiral\Tests\Core\Stub\EngineMarkTwo;
-final class ExceptionsTest extends BaseTest
+final class ExceptionsTest extends BaseTestCase
{
public function testMissingRequiredTypedParameter(): void
{
diff --git a/src/Core/tests/Internal/Resolver/NamedArgumentsTest.php b/src/Core/tests/Internal/Resolver/NamedArgumentsTest.php
index 26eeb500a..59775ed0f 100644
--- a/src/Core/tests/Internal/Resolver/NamedArgumentsTest.php
+++ b/src/Core/tests/Internal/Resolver/NamedArgumentsTest.php
@@ -12,7 +12,7 @@
* @see NullableParameterTest::testNullableDefaultScalarAndNamedArgumentNull()
* @see ReferenceParameterTest::testInvokeReferencedArguments
*/
-final class NamedArgumentsTest extends BaseTest
+final class NamedArgumentsTest extends BaseTestCase
{
/**
* In this case, second argument will be set from parameters by name, and first argument from container.
diff --git a/src/Core/tests/Internal/Resolver/NullableParameterTest.php b/src/Core/tests/Internal/Resolver/NullableParameterTest.php
index 121b14ef4..cd5c80854 100644
--- a/src/Core/tests/Internal/Resolver/NullableParameterTest.php
+++ b/src/Core/tests/Internal/Resolver/NullableParameterTest.php
@@ -15,7 +15,7 @@
* @see VariadicParameterTest::testNullableVariadicArgument()
* @see ReferenceParameterTest::testInvokeReferencedArguments()
*/
-final class NullableParameterTest extends BaseTest
+final class NullableParameterTest extends BaseTestCase
{
public function testNullableDefaultNull(): void
{
diff --git a/src/Core/tests/Internal/Resolver/PositionArgumentTest.php b/src/Core/tests/Internal/Resolver/PositionArgumentTest.php
index d8076a5b0..84cccb949 100644
--- a/src/Core/tests/Internal/Resolver/PositionArgumentTest.php
+++ b/src/Core/tests/Internal/Resolver/PositionArgumentTest.php
@@ -13,7 +13,7 @@
/**
* @see VariadicParameterTest::testVariadicObjectParameterAndPositionArguments()
*/
-final class PositionArgumentTest extends BaseTest
+final class PositionArgumentTest extends BaseTestCase
{
/**
* In this case, first argument will be pulled from container, second - from args list.
diff --git a/src/Core/tests/Internal/Resolver/ReferenceParameterTest.php b/src/Core/tests/Internal/Resolver/ReferenceParameterTest.php
index a44ab6d5f..bd8295e47 100644
--- a/src/Core/tests/Internal/Resolver/ReferenceParameterTest.php
+++ b/src/Core/tests/Internal/Resolver/ReferenceParameterTest.php
@@ -12,7 +12,7 @@
use Spiral\Tests\Core\Stub\EngineMarkTwo;
use stdClass;
-final class ReferenceParameterTest extends BaseTest
+final class ReferenceParameterTest extends BaseTestCase
{
public function testReferencedVariadicParameterAndUnnamedArguments(): void
{
diff --git a/src/Core/tests/Internal/Resolver/ResolvingValidationTest.php b/src/Core/tests/Internal/Resolver/ResolvingValidationTest.php
index 8797a37e1..3276492cb 100644
--- a/src/Core/tests/Internal/Resolver/ResolvingValidationTest.php
+++ b/src/Core/tests/Internal/Resolver/ResolvingValidationTest.php
@@ -9,7 +9,7 @@
use Spiral\Tests\Core\Stub\EngineInterface;
use stdClass;
-final class ResolvingValidationTest extends BaseTest
+final class ResolvingValidationTest extends BaseTestCase
{
public function testNullInsteadOfClass(): void
{
diff --git a/src/Core/tests/Internal/Resolver/TypeIntersectionParameterTest.php b/src/Core/tests/Internal/Resolver/TypeIntersectionParameterTest.php
index da5ea8f2c..c573c145e 100644
--- a/src/Core/tests/Internal/Resolver/TypeIntersectionParameterTest.php
+++ b/src/Core/tests/Internal/Resolver/TypeIntersectionParameterTest.php
@@ -4,7 +4,6 @@
namespace Spiral\Tests\Core\Internal\Resolver;
-use Spiral\Core\Exception\Container\ArgumentException;
use Spiral\Tests\Core\Stub\EngineInterface;
use Spiral\Tests\Core\Stub\EngineMarkTwo;
use Spiral\Tests\Core\Stub\EngineVAZ2101;
@@ -12,7 +11,7 @@
use Spiral\Tests\Core\Stub\MadeInUssrInterface;
use stdClass;
-final class TypeIntersectionParameterTest extends BaseTest
+final class TypeIntersectionParameterTest extends BaseTestCase
{
public function testTypeIntersectionParameterAndUnnamedArgument(): void
{
diff --git a/src/Core/tests/Internal/Resolver/UnionTypeParameterTest.php b/src/Core/tests/Internal/Resolver/UnionTypeParameterTest.php
index be2d079f5..042ff2bfe 100644
--- a/src/Core/tests/Internal/Resolver/UnionTypeParameterTest.php
+++ b/src/Core/tests/Internal/Resolver/UnionTypeParameterTest.php
@@ -13,7 +13,7 @@
* @see NullableParameterTest::testNullableUnionDefaultScalar()
* @see VariadicParameterTest::testVariadicUnionParameterAndUnnamedArguments()
*/
-final class UnionTypeParameterTest extends BaseTest
+final class UnionTypeParameterTest extends BaseTestCase
{
public function testScalarOrClassFromContainer(): void
{
diff --git a/src/Core/tests/Internal/Resolver/VariadicParameterTest.php b/src/Core/tests/Internal/Resolver/VariadicParameterTest.php
index 52ef1fddd..63edd47e1 100644
--- a/src/Core/tests/Internal/Resolver/VariadicParameterTest.php
+++ b/src/Core/tests/Internal/Resolver/VariadicParameterTest.php
@@ -19,7 +19,7 @@
* @see ReferenceParameterTest::testInvokeReferencedArguments()
* @see TypeIntersectionParameterTest::testVariadicTypeIntersectionParameterAndUnnamedArguments()
*/
-final class VariadicParameterTest extends BaseTest
+final class VariadicParameterTest extends BaseTestCase
{
/**
* A values collection for a variadic parameter can be passed as an array in a named argument.
diff --git a/src/Core/tests/InvokerTest.php b/src/Core/tests/InvokerTest.php
index 08a8f7ca0..a53bb8519 100644
--- a/src/Core/tests/InvokerTest.php
+++ b/src/Core/tests/InvokerTest.php
@@ -65,7 +65,7 @@ public function testCallValidCallableArrayWithResolvingFromContainer(): void
public function testCallValidCallableArrayWithNotResolvableDependencies(): void
{
$this->expectException(ArgumentResolvingException::class);
- $this->expectErrorMessage('Unable to resolve required argument `name` when resolving');
+ $this->expectExceptionMessage('Unable to resolve required argument `name` when resolving');
$this->container->invoke([new Storage(), 'makeBucket'], ['name' => 'bar']);
}
@@ -85,7 +85,7 @@ public function testCallValidCallableString(): void
public function testCallValidCallableStringWithNotResolvableDependencies(): void
{
$this->expectException(ArgumentResolvingException::class);
- $this->expectErrorMessage('Unable to resolve required argument `name` when resolving');
+ $this->expectExceptionMessage('Unable to resolve required argument `name` when resolving');
$this->container->invoke(Storage::class.'::createBucket', ['name' => 'bar']);
}
@@ -110,7 +110,7 @@ static function (Bucket $bucket, SampleClass $class, string $name, string $path
public function testCallValidClosureWithNotResolvableDependencies(): void
{
$this->expectException(ArgumentResolvingException::class);
- $this->expectErrorMessage('Unable to resolve required argument `name` when resolving');
+ $this->expectExceptionMessage('Unable to resolve required argument `name` when resolving');
$this->container->invoke(
static function (Bucket $bucket, SampleClass $class, string $name, string $path = 'baz') {
@@ -123,7 +123,7 @@ static function (Bucket $bucket, SampleClass $class, string $name, string $path
public function testInvalidCallableStringShouldThrowAnException(): void
{
$this->expectException(NotCallableException::class);
- $this->expectErrorMessage('Unsupported callable');
+ $this->expectExceptionMessage('Unsupported callable');
$this->container->invoke('foobar');
}
@@ -131,7 +131,7 @@ public function testInvalidCallableStringShouldThrowAnException(): void
public function testInvalidCallableArrayShouldThrowAnException(): void
{
$this->expectException(NotCallableException::class);
- $this->expectErrorMessage('Unsupported callable');
+ $this->expectExceptionMessage('Unsupported callable');
$object = new Storage();
diff --git a/src/Core/tests/Scope/BaseTest.php b/src/Core/tests/Scope/BaseTestCase.php
similarity index 73%
rename from src/Core/tests/Scope/BaseTest.php
rename to src/Core/tests/Scope/BaseTestCase.php
index a66d1b7f2..2d68083d3 100644
--- a/src/Core/tests/Scope/BaseTest.php
+++ b/src/Core/tests/Scope/BaseTestCase.php
@@ -7,7 +7,7 @@
use PHPUnit\Framework\TestCase;
use WeakMap;
-abstract class BaseTest extends TestCase
+abstract class BaseTestCase extends TestCase
{
public WeakMap $weakMap;
@@ -22,9 +22,4 @@ protected function tearDown(): void
self::assertEmpty($this->weakMap, 'Weak map is not empty.');
parent::tearDown();
}
-
- public function makeStdClass(array $params = []): \stdClass
- {
- return (object)$params;
- }
}
diff --git a/src/Core/tests/Scope/ExceptionsTest.php b/src/Core/tests/Scope/ExceptionsTest.php
index 800f7d9e3..859df9cd5 100644
--- a/src/Core/tests/Scope/ExceptionsTest.php
+++ b/src/Core/tests/Scope/ExceptionsTest.php
@@ -4,12 +4,14 @@
namespace Spiral\Tests\Core\Scope;
+use PHPUnit\Framework\Attributes\Group;
use Spiral\Core\Container;
use Spiral\Core\Exception\Container\NotFoundException;
use Spiral\Tests\Core\Scope\Stub\DatetimeCarrier;
use Spiral\Tests\Core\Scope\Stub\ExceptionConstructor;
-final class ExceptionsTest extends BaseTest
+#[Group('scrutinizer-ignore')]
+final class ExceptionsTest extends BaseTestCase
{
public function testParentScopeResolvingCustomException(): void
{
diff --git a/src/Core/tests/Scope/FibersTest.php b/src/Core/tests/Scope/FibersTest.php
index f29c6aca0..6498f77cb 100644
--- a/src/Core/tests/Scope/FibersTest.php
+++ b/src/Core/tests/Scope/FibersTest.php
@@ -13,7 +13,7 @@
use Spiral\Core\ContainerScope;
use stdClass;
-final class FibersTest extends BaseTest
+final class FibersTest extends BaseTestCase
{
public const TEST_DATA = [
'foo' => 1,
diff --git a/src/Core/tests/Scope/FinalizeAttributeTest.php b/src/Core/tests/Scope/FinalizeAttributeTest.php
index 46e5f436c..a96bf7997 100644
--- a/src/Core/tests/Scope/FinalizeAttributeTest.php
+++ b/src/Core/tests/Scope/FinalizeAttributeTest.php
@@ -4,6 +4,7 @@
namespace Spiral\Tests\Core\Scope;
+use PHPUnit\Framework\Attributes\Group;
use Spiral\Core\Container;
use Spiral\Core\Exception\Scope\FinalizersException;
use Spiral\Tests\Core\Scope\Stub\AttrFinalize;
@@ -11,7 +12,7 @@
use Spiral\Tests\Core\Scope\Stub\FileLogger;
use Spiral\Tests\Core\Scope\Stub\LoggerInterface;
-final class FinalizeAttributeTest extends BaseTest
+final class FinalizeAttributeTest extends BaseTestCase
{
/**
* Finalizer from a attribute should be registered and called when a related scope is destroyed.
@@ -115,6 +116,7 @@ public function testFinalizerWithoutConcreteScopeInRoot(): void
self::assertInstanceOf(LoggerInterface::class, $obj->logger);
}
+ #[Group('scrutinizer-ignore')]
public function testExceptionOnDestroy()
{
$root = new Container();
@@ -143,6 +145,7 @@ public function testExceptionOnDestroy()
}
}
+ #[Group('scrutinizer-ignore')]
public function testManyExceptionsOnDestroy()
{
$root = new Container();
diff --git a/src/Core/tests/Scope/ScopeAttributeTest.php b/src/Core/tests/Scope/ScopeAttributeTest.php
index fb63278b9..360596a2f 100644
--- a/src/Core/tests/Scope/ScopeAttributeTest.php
+++ b/src/Core/tests/Scope/ScopeAttributeTest.php
@@ -4,6 +4,7 @@
namespace Spiral\Tests\Core\Scope;
+use PHPUnit\Framework\Attributes\Group;
use Spiral\Core\Attribute\Scope;
use Spiral\Core\Container;
use Spiral\Core\Exception\Container\NotFoundException;
@@ -12,7 +13,7 @@
use Spiral\Tests\Core\Scope\Stub\AttrScopeFoo;
use Spiral\Tests\Core\Scope\Stub\AttrScopeFooSingleton;
-final class ScopeAttributeTest extends BaseTest
+final class ScopeAttributeTest extends BaseTestCase
{
/**
* Just try to make a dependency with a wrong scope.
@@ -46,6 +47,7 @@ public function testNamedScopeResolveFromRootInNullScope(): void
* Request a dependency from a correct scope using alias but there is no any binding for this alias in the scope.
* The binding can be in the parent scope, but it doesn't matter.
*/
+ #[Group('scrutinizer-ignore')]
public function testRequestObjectFromValidScopeUsingFactoryFromWrongScope(): void
{
self::expectException(NotFoundException::class);
@@ -64,6 +66,7 @@ public function testRequestObjectFromValidScopeUsingFactoryFromWrongScope(): voi
/**
* Request a dependency from an unnamed scope using alias and there is no any binding in valid scope for this alias.
*/
+ #[Group('scrutinizer-ignore')]
public function testNamedScopeUseFactoryInWrongParentScope(): void
{
self::expectException(BadScopeException::class);
@@ -83,6 +86,7 @@ public function testNamedScopeUseFactoryInWrongParentScope(): void
* In the parent hierarchy, the needed scope specified twice.
* You can't create nested scopes with the same name.
*/
+ #[Group('scrutinizer-ignore')]
public function testNamedScopeDuplication(): void
{
self::expectException(NamedScopeDuplicationException::class);
@@ -108,6 +112,7 @@ public function testNamedScopeDuplication(): void
* The {@see BasScopeException} must be thrown when trying to resolve a class with the {@see Scope} attribute
* in a scope that is not specified in the attribute.
*/
+ #[Group('scrutinizer-ignore')]
public function testBadScopeException(): void
{
self::expectException(BadScopeException::class);
diff --git a/src/Core/tests/Scope/SideEffectTest.php b/src/Core/tests/Scope/SideEffectTest.php
index 3e61d1c1c..9ce91d7b9 100644
--- a/src/Core/tests/Scope/SideEffectTest.php
+++ b/src/Core/tests/Scope/SideEffectTest.php
@@ -11,7 +11,7 @@
use Spiral\Tests\Core\Scope\Stub\LoggerCarrier;
use Spiral\Tests\Core\Scope\Stub\LoggerInterface;
-final class SideEffectTest extends BaseTest
+final class SideEffectTest extends BaseTestCase
{
/**
* When a dependency is resolving from parent then all its dependencies are resolved from parent too.
diff --git a/src/Core/tests/Scope/UseCaseTest.php b/src/Core/tests/Scope/UseCaseTest.php
index 1a8f6efa6..7761be7dc 100644
--- a/src/Core/tests/Scope/UseCaseTest.php
+++ b/src/Core/tests/Scope/UseCaseTest.php
@@ -4,13 +4,15 @@
namespace Spiral\Tests\Core\Scope;
+use PHPUnit\Framework\Attributes\DataProvider;
use Psr\Container\ContainerInterface;
use Spiral\Core\Container;
use Spiral\Core\Exception\Scope\ScopeContainerLeakedException;
+use Spiral\Tests\Core\Fixtures\Factory;
use Spiral\Tests\Core\Fixtures\SampleClass;
use stdClass;
-final class UseCaseTest extends BaseTest
+final class UseCaseTest extends BaseTestCase
{
/**
* Parent container won't be destroyed when child container is destroyed.
@@ -46,9 +48,8 @@ public function testChildContainerDestruction(): void
/**
* A child scope bindings are not singleton.
- *
- * @dataProvider provideScopeBindingsAsNotSingletons
*/
+ #[DataProvider('provideScopeBindingsAsNotSingletons')]
public function testScopeBindingsAsNotSingletons(bool $theSame, string $alias, mixed $definition): void
{
$root = new Container();
@@ -63,8 +64,9 @@ public function testScopeBindingsAsNotSingletons(bool $theSame, string $alias, m
}, bindings: [$alias => $definition]);
}
- public function provideScopeBindingsAsNotSingletons(): iterable {
- yield 'array-factory' => [false, 'foo', [self::class, 'makeStdClass']];
+ public static function provideScopeBindingsAsNotSingletons(): iterable
+ {
+ yield 'array-factory' => [false, 'foo', [Factory::class, 'makeStdClass']];
yield 'class-name' => [false, SampleClass::class, SampleClass::class];
yield 'object' => [true, stdClass::class, new stdClass()];
}
@@ -92,11 +94,11 @@ public function testScopeDefinition(): void
self::assertNotSame($c1, $c2);
self::assertInstanceOf(stdClass::class, $obj2);
self::assertNotSame($obj1, $obj2);
- }, bindings: ['foo' => [self::class, 'makeStdClass']]);
+ }, bindings: ['foo' => [Factory::class, 'makeStdClass']]);
// $obj2 should be garbage collected
self::assertCount(1, $this->weakMap);
- }, bindings: ['foo' => [self::class, 'makeStdClass']]);
+ }, bindings: ['foo' => [Factory::class, 'makeStdClass']]);
// $obj1 should be garbage collected
self::assertEmpty($this->weakMap);
@@ -110,7 +112,7 @@ public function testScopeDefinition(): void
public function testChildContainerResolvesDepsFromParent(): void
{
$root = new Container();
- $root->bindSingleton('bar', [self::class, 'makeStdClass']);
+ $root->bindSingleton('bar', [Factory::class, 'makeStdClass']);
$root->bind(stdClass::class, new stdClass());
$root->scope(function (ContainerInterface $c1) use ($root) {
@@ -134,7 +136,7 @@ public function testChildContainerResolvesDepsFromParent(): void
"Nested container mustn't create new instance using class name as key without definition."
);
});
- }, bindings: ['foo' => [self::class, 'makeStdClass']]);
+ }, bindings: ['foo' => [Factory::class, 'makeStdClass']]);
}
/**
@@ -171,12 +173,13 @@ public function testBindingScopes(): void
*/
public function testBindingInFewSameScopes(): void
{
+ $factory = new Factory();
$root = new Container();
- $root->getBinder('scope1')->bindSingleton('foo', $this->makeStdClass(...));
+ $root->getBinder('scope1')->bindSingleton('foo', $factory->makeStdClass(...));
- $getter = fn () => $root->scope(function (Container $c1): mixed {
+ $getter = fn () => $root->scope(function (Container $c1) use ($factory): mixed {
self::assertFalse($c1->has('bar'));
- $c1->bindSingleton('bar', $this->makeStdClass(...));
+ $c1->bindSingleton('bar', $factory->makeStdClass(...));
return $c1->get('foo');
}, name: 'scope1');
@@ -192,10 +195,11 @@ public function testBindingInFewSameScopes(): void
*/
public function testScopeBinderAffectsDefaultBindingsOnly(): void
{
+ $factory = new Factory();
$root = new Container();
- $root->scope(function (Container $c1): void {
- $c1->getBinder('scope1')->bindSingleton('bar', $this->makeStdClass(...));
+ $root->scope(function (Container $c1) use ($factory): void {
+ $c1->getBinder('scope1')->bindSingleton('bar', $factory->makeStdClass(...));
self::assertFalse($c1->has('bar'));
}, name: 'scope1');
diff --git a/src/Core/tests/SingletonsTest.php b/src/Core/tests/SingletonsTest.php
index 8d879adbe..45d1e8b90 100644
--- a/src/Core/tests/SingletonsTest.php
+++ b/src/Core/tests/SingletonsTest.php
@@ -4,10 +4,12 @@
namespace Spiral\Tests\Core;
+use PHPUnit\Framework\Attributes\DataProvider;
use PHPUnit\Framework\TestCase;
use Spiral\Core\Attribute\Singleton;
use Spiral\Core\Container;
use Spiral\Tests\Core\Fixtures\DeclarativeSingleton;
+use Spiral\Tests\Core\Fixtures\Factory;
use Spiral\Tests\Core\Fixtures\SampleClass;
use Spiral\Tests\Core\Fixtures\SingletonAttribute;
@@ -81,7 +83,7 @@ public function testSingletonFactory(): void
{
$container = new Container();
- $container->bindSingleton('sampleClass', [self::class, 'sampleClass']);
+ $container->bindSingleton('sampleClass', [Factory::class, 'sampleClass']);
$instance = $container->get('sampleClass');
@@ -89,9 +91,7 @@ public function testSingletonFactory(): void
$this->assertSame($instance, $container->get('sampleClass'));
}
- /**
- * @dataProvider SingletonWithCustomArgsProvider
- */
+ #[DataProvider('singletonWithCustomArgsProvider')]
public function testSingletonWithCustomArgs(string $alias, mixed $definition): void
{
$container = new Container();
@@ -106,11 +106,24 @@ public function testSingletonWithCustomArgs(string $alias, mixed $definition): v
$this->assertSame($instance, $container->make($alias));
}
- public function SingletonWithCustomArgsProvider(): iterable
+ public function testSingletonWithCustomArgsObject(): void
+ {
+ $container = new Container();
+ $container->bindSingleton('sampleClass', self::class::sampleClass());
+ $instance = $container->make('sampleClass');
+
+ $this->assertSame($instance, $container->make('sampleClass'));
+ $this->assertSame($instance, $container->make('sampleClass', []));
+ $this->assertNotSame($instance, $bar = $container->make('sampleClass', ['bar']));
+ $this->assertNotSame($bar, $container->make('sampleClass', ['bar']));
+ // The binding mustn't be rebound
+ $this->assertSame($instance, $container->make('sampleClass'));
+ }
+
+ public static function singletonWithCustomArgsProvider(): iterable
{
static $obj = new \stdClass();
- yield 'array-factory' => ['sampleClass', [self::class, 'sampleClass']];
- yield 'object' => ['sampleClass', self::class::sampleClass()];
+ yield 'array-factory' => ['sampleClass', [Factory::class, 'sampleClass']];
yield 'class-name' => ['sampleClass', SampleClass::class];
yield 'reference-existing' => ['stdClass', \WeakReference::create($obj)];
}
diff --git a/src/Csrf/composer.json b/src/Csrf/composer.json
index 1871140eb..98fc0a75f 100644
--- a/src/Csrf/composer.json
+++ b/src/Csrf/composer.json
@@ -33,7 +33,7 @@
"psr/http-server-middleware": "^1.0"
},
"require-dev": {
- "phpunit/phpunit": "^9.5.20",
+ "phpunit/phpunit": "^10.1",
"mockery/mockery": "^1.5",
"spiral/http": "^3.8",
"nyholm/psr7": "^1.5",
diff --git a/src/Debug/composer.json b/src/Debug/composer.json
index dc03eef27..c8cfc4116 100644
--- a/src/Debug/composer.json
+++ b/src/Debug/composer.json
@@ -31,7 +31,7 @@
"spiral/logger": "^3.8"
},
"require-dev": {
- "phpunit/phpunit": "^9.5.20",
+ "phpunit/phpunit": "^10.1",
"vimeo/psalm": "^5.9"
},
"autoload": {
diff --git a/src/Distribution/composer.json b/src/Distribution/composer.json
index 05049c9fd..b8f18e3a9 100644
--- a/src/Distribution/composer.json
+++ b/src/Distribution/composer.json
@@ -28,7 +28,7 @@
"aws/aws-sdk-php": "^3.0",
"guzzlehttp/psr7": "^1.7",
"jetbrains/phpstorm-attributes": "^1.0",
- "phpunit/phpunit": "^9.5.20",
+ "phpunit/phpunit": "^10.1",
"vimeo/psalm": "^5.9"
},
"autoload-dev": {
diff --git a/src/Encrypter/composer.json b/src/Encrypter/composer.json
index dd44d9c65..d73425eb9 100644
--- a/src/Encrypter/composer.json
+++ b/src/Encrypter/composer.json
@@ -33,7 +33,7 @@
"defuse/php-encryption": "^2.2"
},
"require-dev": {
- "phpunit/phpunit": "^9.5.20",
+ "phpunit/phpunit": "^10.1",
"vimeo/psalm": "^5.9"
},
"autoload": {
diff --git a/src/Events/composer.json b/src/Events/composer.json
index 169240101..44d0a6f95 100644
--- a/src/Events/composer.json
+++ b/src/Events/composer.json
@@ -34,7 +34,7 @@
},
"require-dev": {
"spiral/boot": "^3.8",
- "phpunit/phpunit": "^9.5.20",
+ "phpunit/phpunit": "^10.1",
"mockery/mockery": "^1.5",
"vimeo/psalm": "^5.9"
},
diff --git a/src/Events/tests/AutowireListenerFactoryTest.php b/src/Events/tests/AutowireListenerFactoryTest.php
index 03dc4a7ad..ae7f3d1e3 100644
--- a/src/Events/tests/AutowireListenerFactoryTest.php
+++ b/src/Events/tests/AutowireListenerFactoryTest.php
@@ -102,7 +102,7 @@ public function testCreateAutowiredListenerForObject(): void
public function testListenerWithoutMethodShouldThrowAnException(): void
{
$this->expectException(BadMethodCallException::class);
- $this->expectErrorMessage(
+ $this->expectExceptionMessage(
'Listener `Spiral\Tests\Events\Fixtures\Listener\ClassAndMethodAttribute` does not contain `test` method.'
);
diff --git a/src/Events/tests/Processor/AttributeProcessorTest.php b/src/Events/tests/Processor/AttributeProcessorTest.php
index c74f41729..71b6b641c 100644
--- a/src/Events/tests/Processor/AttributeProcessorTest.php
+++ b/src/Events/tests/Processor/AttributeProcessorTest.php
@@ -5,6 +5,7 @@
namespace Spiral\Tests\Events\Processor;
use Mockery as m;
+use PHPUnit\Framework\Attributes\DataProvider;
use PHPUnit\Framework\TestCase;
use Spiral\Attributes\ReaderInterface;
use Spiral\Events\Attribute\Listener;
@@ -56,7 +57,7 @@ public function testEventListenerShouldNotBeRegisteredWithListenerRegistry(): vo
public function testEventListenerShouldThrowAnExceptionWhenListenerNotFinalized(): void
{
$this->expectException(\RuntimeException::class);
- $this->expectErrorMessage('Tokenizer did not finalize Spiral\Events\Processor\AttributeProcessor listener.');
+ $this->expectExceptionMessage('Tokenizer did not finalize Spiral\Events\Processor\AttributeProcessor listener.');
$tokenizerRegistry = m::mock(TokenizerListenerRegistryInterface::class);
$reader = m::mock(ReaderInterface::class);
@@ -71,8 +72,8 @@ public function testEventListenerShouldThrowAnExceptionWhenListenerNotFinalized(
/**
* @param class-string $class
- * @dataProvider listenersDataProvider
*/
+ #[DataProvider('listenersDataProvider')]
public function testProcess(string $class, Listener $listener, array $args, int $listeners = 1): void
{
$tokenizerRegistry = m::mock(TokenizerListenerRegistryInterface::class);
@@ -99,7 +100,7 @@ public function testProcess(string $class, Listener $listener, array $args, int
$this->assertSame($listeners, $registry->listeners);
}
- public function listenersDataProvider(): \Traversable
+ public static function listenersDataProvider(): \Traversable
{
yield [
ClassAndMethodAttribute::class,
diff --git a/src/Events/tests/Processor/ConfigProcessorTest.php b/src/Events/tests/Processor/ConfigProcessorTest.php
index beb5bf148..a1d4003b8 100644
--- a/src/Events/tests/Processor/ConfigProcessorTest.php
+++ b/src/Events/tests/Processor/ConfigProcessorTest.php
@@ -4,8 +4,8 @@
namespace Spiral\Tests\Events\Processor;
+use PHPUnit\Framework\Attributes\DataProvider;
use PHPUnit\Framework\TestCase;
-use Spiral\Core\Container;
use Spiral\Events\Config\EventListener;
use Spiral\Events\Config\EventsConfig;
use Spiral\Events\AutowireListenerFactory;
@@ -18,10 +18,8 @@
final class ConfigProcessorTest extends TestCase
{
- /**
- * @dataProvider listenersDataProvider
- */
- public function testProcess(string $class, array $listener, array $args): void
+ #[DataProvider('listenersDataProvider')]
+ public function testProcess(array $listener, array $args): void
{
$registry = new class() implements ListenerRegistryInterface {
@@ -49,10 +47,9 @@ public function addListener(string $event, callable $listener, int $priority = 0
$this->assertSame($args[2], $registry->priority);
}
- public function listenersDataProvider(): \Traversable
+ public static function listenersDataProvider(): \Traversable
{
yield [
- ClassAndMethodAttribute::class,
[
FooEvent::class => [new EventListener(ClassAndMethodAttribute::class, 'onFooEvent', 1)]
],
@@ -63,7 +60,6 @@ public function listenersDataProvider(): \Traversable
]
];
yield [
- ClassAndMethodAttribute::class,
[
BarEvent::class => [new EventListener(ClassAndMethodAttribute::class, 'onBarEvent', 1)]
],
@@ -74,7 +70,6 @@ public function listenersDataProvider(): \Traversable
]
];
yield [
- ClassAttribute::class,
[BarEvent::class => [ClassAttribute::class]],
[
BarEvent::class,
diff --git a/src/Exceptions/composer.json b/src/Exceptions/composer.json
index a5f2a8dc5..7f56fad3b 100644
--- a/src/Exceptions/composer.json
+++ b/src/Exceptions/composer.json
@@ -37,7 +37,7 @@
},
"require-dev": {
"mockery/mockery": "^1.5",
- "phpunit/phpunit": "^9.5.20",
+ "phpunit/phpunit": "^10.1",
"vimeo/psalm": "^5.9"
},
"autoload": {
diff --git a/src/Exceptions/tests/Renderer/RendererTest.php b/src/Exceptions/tests/Renderer/RendererTest.php
index 91cf56df6..21099d8cc 100644
--- a/src/Exceptions/tests/Renderer/RendererTest.php
+++ b/src/Exceptions/tests/Renderer/RendererTest.php
@@ -4,7 +4,6 @@
namespace Spiral\Tests\Exceptions\Renderer;
-use PHPUnit\Framework\Error\Error;
use PHPUnit\Framework\TestCase;
use Spiral\Exceptions\Renderer\ConsoleRenderer;
use Spiral\Exceptions\Renderer\JsonRenderer;
@@ -16,32 +15,19 @@ public function testGetMessage(): void
{
$handler = new ConsoleRenderer();
- $this->assertStringContainsString('Error', $handler->render(new Error(
+ $this->assertStringContainsString('Error', $handler->render(new \Error(
'message',
100,
- __FILE__,
- __LINE__
)));
- $this->assertStringContainsString('message', $handler->render(new Error(
+ $this->assertStringContainsString('message', $handler->render(new \Error(
'message',
100,
- __FILE__,
- __LINE__
)));
- $this->assertStringContainsString('RendererTest.php', $handler->render(new Error(
+ $this->assertStringContainsString('RendererTest.php', $handler->render(new \Error(
'message',
100,
- __FILE__,
- __LINE__
- )));
-
- $this->assertStringContainsString('100', $handler->render(new Error(
- 'message',
- 100,
- __FILE__,
- 100
)));
}
@@ -50,11 +36,9 @@ public function testConsoleRendererWithoutColorsBasic(): void
$handler = new ConsoleRenderer();
$handler->setColorsSupport(false);
- $result = $handler->render(new Error(
+ $result = $handler->render(new \Error(
'message',
100,
- __FILE__,
- __LINE__
), \Spiral\Exceptions\Verbosity::BASIC);
$this->assertStringContainsString('Error', $result);
@@ -98,11 +82,9 @@ public function testConsoleRendererWithColorsBasic(): void
$handler = new ConsoleRenderer();
$handler->setColorsSupport(true);
- $result = $handler->render(new Error(
+ $result = $handler->render(new \Error(
'message',
100,
- __FILE__,
- __LINE__
), \Spiral\Exceptions\Verbosity::BASIC);
$this->assertStringContainsString('Error', $result);
@@ -118,11 +100,9 @@ public function testConsoleRendererWithColorsDebug(): void
$handler = new ConsoleRenderer();
$handler->setColorsSupport(true);
- $result = $handler->render(new Error(
+ $result = $handler->render(new \Error(
'message',
100,
- __FILE__,
- __LINE__
), \Spiral\Exceptions\Verbosity::DEBUG);
$this->assertStringContainsString('Error', $result);
diff --git a/src/Exceptions/tests/VerbosityTest.php b/src/Exceptions/tests/VerbosityTest.php
index 8196db5e7..982f21559 100644
--- a/src/Exceptions/tests/VerbosityTest.php
+++ b/src/Exceptions/tests/VerbosityTest.php
@@ -2,6 +2,7 @@
namespace Spiral\Tests\Exceptions;
+use PHPUnit\Framework\Attributes\DataProvider;
use PHPUnit\Framework\TestCase;
use Spiral\Boot\EnvironmentInterface;
use Spiral\Exceptions\Verbosity;
@@ -9,7 +10,7 @@
final class VerbosityTest extends TestCase
{
- /** @dataProvider envVariablesDataProvider */
+ #[DataProvider('envVariablesDataProvider')]
public function testDetectEnvironmentVariable($name, Verbosity $expected): void
{
$env = m::mock(EnvironmentInterface::class);
@@ -24,19 +25,17 @@ public function testDetectEnvironmentVariable($name, Verbosity $expected): void
$this->assertSame($expected, $enum);
}
- public function envVariablesDataProvider(): array
+ public static function envVariablesDataProvider(): \Traversable
{
- return [
- ['basic', Verbosity::BASIC],
- [0, Verbosity::BASIC],
- ['Basic', Verbosity::BASIC],
- ['debug', Verbosity::DEBUG],
- [2, Verbosity::DEBUG],
- ['invalid', Verbosity::VERBOSE],
- ['', Verbosity::VERBOSE],
- [null, Verbosity::VERBOSE],
- [true, Verbosity::VERBOSE],
- [false, Verbosity::VERBOSE],
- ];
+ yield ['basic', Verbosity::BASIC];
+ yield [0, Verbosity::BASIC];
+ yield ['Basic', Verbosity::BASIC];
+ yield ['debug', Verbosity::DEBUG];
+ yield [2, Verbosity::DEBUG];
+ yield ['invalid', Verbosity::VERBOSE];
+ yield ['', Verbosity::VERBOSE];
+ yield [null, Verbosity::VERBOSE];
+ yield [true, Verbosity::VERBOSE];
+ yield [false, Verbosity::VERBOSE];
}
}
diff --git a/src/Files/composer.json b/src/Files/composer.json
index 9c059fca9..857060619 100644
--- a/src/Files/composer.json
+++ b/src/Files/composer.json
@@ -30,7 +30,7 @@
"php": ">=8.1"
},
"require-dev": {
- "phpunit/phpunit": "^9.5.20",
+ "phpunit/phpunit": "^10.1",
"mockery/mockery": "^1.5",
"vimeo/psalm": "^5.9"
},
diff --git a/src/Filters/composer.json b/src/Filters/composer.json
index d1c80ca6c..869716cfd 100644
--- a/src/Filters/composer.json
+++ b/src/Filters/composer.json
@@ -39,7 +39,7 @@
"require-dev": {
"mockery/mockery": "^1.5",
"nyholm/psr7": "^1.5",
- "phpunit/phpunit": "^9.5.20",
+ "phpunit/phpunit": "^10.1",
"vimeo/psalm": "^5.9"
},
"autoload": {
diff --git a/src/Filters/tests/BaseTest.php b/src/Filters/tests/BaseTestCase.php
similarity index 91%
rename from src/Filters/tests/BaseTest.php
rename to src/Filters/tests/BaseTestCase.php
index 25d97290b..4b6ab9695 100644
--- a/src/Filters/tests/BaseTest.php
+++ b/src/Filters/tests/BaseTestCase.php
@@ -10,7 +10,7 @@
use Spiral\Validation\ValidationInterface;
use Spiral\Validation\ValidationProvider;
-abstract class BaseTest extends TestCase
+abstract class BaseTestCase extends TestCase
{
protected ContainerInterface $container;
diff --git a/src/Filters/tests/InputScopeTest.php b/src/Filters/tests/InputScopeTest.php
index 3bc30e79e..c7e8797cd 100644
--- a/src/Filters/tests/InputScopeTest.php
+++ b/src/Filters/tests/InputScopeTest.php
@@ -9,7 +9,7 @@
use Spiral\Filter\InputScope;
use Spiral\Filters\InputInterface;
-final class InputScopeTest extends BaseTest
+final class InputScopeTest extends BaseTestCase
{
public function setUp(): void
{
diff --git a/src/Filters/tests/Model/Attribute/Input/AttributeTest.php b/src/Filters/tests/Model/Attribute/Input/AttributeTest.php
index 651a5efb1..e31d9b3a0 100644
--- a/src/Filters/tests/Model/Attribute/Input/AttributeTest.php
+++ b/src/Filters/tests/Model/Attribute/Input/AttributeTest.php
@@ -6,7 +6,7 @@
use Spiral\Filters\Attribute\Input\Attribute;
-final class AttributeTest extends \Spiral\Tests\Filters\Model\AttributeTest
+final class AttributeTest extends \Spiral\Tests\Filters\Model\AttributeTestCase
{
public function testGetsValueForDefinedKey(): void
{
diff --git a/src/Filters/tests/Model/Attribute/Input/BearerTokenTest.php b/src/Filters/tests/Model/Attribute/Input/BearerTokenTest.php
index 2faba044b..324ff6083 100644
--- a/src/Filters/tests/Model/Attribute/Input/BearerTokenTest.php
+++ b/src/Filters/tests/Model/Attribute/Input/BearerTokenTest.php
@@ -6,7 +6,7 @@
use Spiral\Filters\Attribute\Input\BearerToken;
-final class BearerTokenTest extends \Spiral\Tests\Filters\Model\AttributeTest
+final class BearerTokenTest extends \Spiral\Tests\Filters\Model\AttributeTestCase
{
public function testGetsValue(): void
{
diff --git a/src/Filters/tests/Model/Attribute/Input/CookieTest.php b/src/Filters/tests/Model/Attribute/Input/CookieTest.php
index a84fd4033..a38a309d2 100644
--- a/src/Filters/tests/Model/Attribute/Input/CookieTest.php
+++ b/src/Filters/tests/Model/Attribute/Input/CookieTest.php
@@ -6,7 +6,7 @@
use Spiral\Filters\Attribute\Input\Cookie;
-final class CookieTest extends \Spiral\Tests\Filters\Model\AttributeTest
+final class CookieTest extends \Spiral\Tests\Filters\Model\AttributeTestCase
{
public function testGetsValueForDefinedKey(): void
{
diff --git a/src/Filters/tests/Model/Attribute/Input/DataTest.php b/src/Filters/tests/Model/Attribute/Input/DataTest.php
index a961e91b0..50de3e5fd 100644
--- a/src/Filters/tests/Model/Attribute/Input/DataTest.php
+++ b/src/Filters/tests/Model/Attribute/Input/DataTest.php
@@ -6,7 +6,7 @@
use Spiral\Filters\Attribute\Input\Data;
-final class DataTest extends \Spiral\Tests\Filters\Model\AttributeTest
+final class DataTest extends \Spiral\Tests\Filters\Model\AttributeTestCase
{
public function testGetsValueForDefinedKey(): void
{
diff --git a/src/Filters/tests/Model/Attribute/Input/FileTest.php b/src/Filters/tests/Model/Attribute/Input/FileTest.php
index bb4969d76..eea6f1a1a 100644
--- a/src/Filters/tests/Model/Attribute/Input/FileTest.php
+++ b/src/Filters/tests/Model/Attribute/Input/FileTest.php
@@ -8,7 +8,7 @@
use Psr\Http\Message\UploadedFileInterface;
use Spiral\Filters\Attribute\Input\File;
-final class FileTest extends \Spiral\Tests\Filters\Model\AttributeTest
+final class FileTest extends \Spiral\Tests\Filters\Model\AttributeTestCase
{
public function testGetsValueForDefinedKey(): void
{
diff --git a/src/Filters/tests/Model/Attribute/Input/HeaderTest.php b/src/Filters/tests/Model/Attribute/Input/HeaderTest.php
index f782537a7..7220a2ec5 100644
--- a/src/Filters/tests/Model/Attribute/Input/HeaderTest.php
+++ b/src/Filters/tests/Model/Attribute/Input/HeaderTest.php
@@ -6,7 +6,7 @@
use Spiral\Filters\Attribute\Input\Header;
-final class HeaderTest extends \Spiral\Tests\Filters\Model\AttributeTest
+final class HeaderTest extends \Spiral\Tests\Filters\Model\AttributeTestCase
{
public function testGetsValueForDefinedKey(): void
{
diff --git a/src/Filters/tests/Model/Attribute/Input/InputTest.php b/src/Filters/tests/Model/Attribute/Input/InputTest.php
index 9a5824913..0cd856a04 100644
--- a/src/Filters/tests/Model/Attribute/Input/InputTest.php
+++ b/src/Filters/tests/Model/Attribute/Input/InputTest.php
@@ -6,7 +6,7 @@
use Spiral\Filters\Attribute\Input\Input;
-final class InputTest extends \Spiral\Tests\Filters\Model\AttributeTest
+final class InputTest extends \Spiral\Tests\Filters\Model\AttributeTestCase
{
public function testGetsValueForDefinedKey(): void
{
diff --git a/src/Filters/tests/Model/Attribute/Input/IsAjaxTest.php b/src/Filters/tests/Model/Attribute/Input/IsAjaxTest.php
index b5095a7c1..3b01e0b53 100644
--- a/src/Filters/tests/Model/Attribute/Input/IsAjaxTest.php
+++ b/src/Filters/tests/Model/Attribute/Input/IsAjaxTest.php
@@ -6,7 +6,7 @@
use Spiral\Filters\Attribute\Input\IsAjax;
-final class IsAjaxTest extends \Spiral\Tests\Filters\Model\AttributeTest
+final class IsAjaxTest extends \Spiral\Tests\Filters\Model\AttributeTestCase
{
public function testGetsValue(): void
{
diff --git a/src/Filters/tests/Model/Attribute/Input/IsJsonExpectedTest.php b/src/Filters/tests/Model/Attribute/Input/IsJsonExpectedTest.php
index 6d1fcb4b3..3d3165149 100644
--- a/src/Filters/tests/Model/Attribute/Input/IsJsonExpectedTest.php
+++ b/src/Filters/tests/Model/Attribute/Input/IsJsonExpectedTest.php
@@ -6,7 +6,7 @@
use Spiral\Filters\Attribute\Input\IsJsonExpected;
-final class IsJsonExpectedTest extends \Spiral\Tests\Filters\Model\AttributeTest
+final class IsJsonExpectedTest extends \Spiral\Tests\Filters\Model\AttributeTestCase
{
public function testGetsValue(): void
{
diff --git a/src/Filters/tests/Model/Attribute/Input/IsSecureTest.php b/src/Filters/tests/Model/Attribute/Input/IsSecureTest.php
index 7292d2ac8..39b93cf75 100644
--- a/src/Filters/tests/Model/Attribute/Input/IsSecureTest.php
+++ b/src/Filters/tests/Model/Attribute/Input/IsSecureTest.php
@@ -6,7 +6,7 @@
use Spiral\Filters\Attribute\Input\IsSecure;
-final class IsSecureTest extends \Spiral\Tests\Filters\Model\AttributeTest
+final class IsSecureTest extends \Spiral\Tests\Filters\Model\AttributeTestCase
{
public function testGetsValue(): void
{
diff --git a/src/Filters/tests/Model/Attribute/Input/MethodTest.php b/src/Filters/tests/Model/Attribute/Input/MethodTest.php
index 11fa43246..5c420ee4d 100644
--- a/src/Filters/tests/Model/Attribute/Input/MethodTest.php
+++ b/src/Filters/tests/Model/Attribute/Input/MethodTest.php
@@ -6,7 +6,7 @@
use Spiral\Filters\Attribute\Input\Method;
-final class MethodTest extends \Spiral\Tests\Filters\Model\AttributeTest
+final class MethodTest extends \Spiral\Tests\Filters\Model\AttributeTestCase
{
public function testGetsValue(): void
{
diff --git a/src/Filters/tests/Model/Attribute/Input/PathTest.php b/src/Filters/tests/Model/Attribute/Input/PathTest.php
index f349bc89d..c38d1b9a3 100644
--- a/src/Filters/tests/Model/Attribute/Input/PathTest.php
+++ b/src/Filters/tests/Model/Attribute/Input/PathTest.php
@@ -6,7 +6,7 @@
use Spiral\Filters\Attribute\Input\Path;
-final class PathTest extends \Spiral\Tests\Filters\Model\AttributeTest
+final class PathTest extends \Spiral\Tests\Filters\Model\AttributeTestCase
{
public function testGetsValue(): void
{
diff --git a/src/Filters/tests/Model/Attribute/Input/PostTest.php b/src/Filters/tests/Model/Attribute/Input/PostTest.php
index e6bb0d253..77e9c09c3 100644
--- a/src/Filters/tests/Model/Attribute/Input/PostTest.php
+++ b/src/Filters/tests/Model/Attribute/Input/PostTest.php
@@ -6,7 +6,7 @@
use Spiral\Filters\Attribute\Input\Post;
-final class PostTest extends \Spiral\Tests\Filters\Model\AttributeTest
+final class PostTest extends \Spiral\Tests\Filters\Model\AttributeTestCase
{
public function testGetsValueForDefinedKey(): void
{
diff --git a/src/Filters/tests/Model/Attribute/Input/QueryTest.php b/src/Filters/tests/Model/Attribute/Input/QueryTest.php
index 7ef4708d4..86e201dcd 100644
--- a/src/Filters/tests/Model/Attribute/Input/QueryTest.php
+++ b/src/Filters/tests/Model/Attribute/Input/QueryTest.php
@@ -6,7 +6,7 @@
use Spiral\Filters\Attribute\Input\Query;
-final class QueryTest extends \Spiral\Tests\Filters\Model\AttributeTest
+final class QueryTest extends \Spiral\Tests\Filters\Model\AttributeTestCase
{
public function testGetsValueForDefinedKey(): void
{
diff --git a/src/Filters/tests/Model/Attribute/Input/RemoteAddressTest.php b/src/Filters/tests/Model/Attribute/Input/RemoteAddressTest.php
index 9c1ccc07f..02ee99dcf 100644
--- a/src/Filters/tests/Model/Attribute/Input/RemoteAddressTest.php
+++ b/src/Filters/tests/Model/Attribute/Input/RemoteAddressTest.php
@@ -6,7 +6,7 @@
use Spiral\Filters\Attribute\Input\RemoteAddress;
-final class RemoteAddressTest extends \Spiral\Tests\Filters\Model\AttributeTest
+final class RemoteAddressTest extends \Spiral\Tests\Filters\Model\AttributeTestCase
{
public function testGetsValue(): void
{
diff --git a/src/Filters/tests/Model/Attribute/Input/RouteTest.php b/src/Filters/tests/Model/Attribute/Input/RouteTest.php
index 6766d9dd1..c6213d067 100644
--- a/src/Filters/tests/Model/Attribute/Input/RouteTest.php
+++ b/src/Filters/tests/Model/Attribute/Input/RouteTest.php
@@ -6,7 +6,7 @@
use Spiral\Filters\Attribute\Input\Route;
-final class RouteTest extends \Spiral\Tests\Filters\Model\AttributeTest
+final class RouteTest extends \Spiral\Tests\Filters\Model\AttributeTestCase
{
public function testGetsValueForDefinedKey(): void
{
diff --git a/src/Filters/tests/Model/Attribute/Input/ServerTest.php b/src/Filters/tests/Model/Attribute/Input/ServerTest.php
index 336a7ce5b..6958101fd 100644
--- a/src/Filters/tests/Model/Attribute/Input/ServerTest.php
+++ b/src/Filters/tests/Model/Attribute/Input/ServerTest.php
@@ -6,7 +6,7 @@
use Spiral\Filters\Attribute\Input\Server;
-final class ServerTest extends \Spiral\Tests\Filters\Model\AttributeTest
+final class ServerTest extends \Spiral\Tests\Filters\Model\AttributeTestCase
{
public function testGetsValueForDefinedKey(): void
{
diff --git a/src/Filters/tests/Model/Attribute/Input/UriTest.php b/src/Filters/tests/Model/Attribute/Input/UriTest.php
index 6d7be97ec..1537c7ddd 100644
--- a/src/Filters/tests/Model/Attribute/Input/UriTest.php
+++ b/src/Filters/tests/Model/Attribute/Input/UriTest.php
@@ -8,7 +8,7 @@
use Psr\Http\Message\UriInterface;
use Spiral\Filters\Attribute\Input\Uri;
-final class UriTest extends \Spiral\Tests\Filters\Model\AttributeTest
+final class UriTest extends \Spiral\Tests\Filters\Model\AttributeTestCase
{
public function testGetsValue(): void
{
diff --git a/src/Filters/tests/Model/Attribute/NestedArrayTest.php b/src/Filters/tests/Model/Attribute/NestedArrayTest.php
index 63f895e8b..7fc03fa42 100644
--- a/src/Filters/tests/Model/Attribute/NestedArrayTest.php
+++ b/src/Filters/tests/Model/Attribute/NestedArrayTest.php
@@ -8,7 +8,7 @@
use Spiral\Filters\Attribute\Input\AbstractInput;
use Spiral\Filters\Attribute\NestedArray;
-final class NestedArrayTest extends \Spiral\Tests\Filters\Model\AttributeTest
+final class NestedArrayTest extends \Spiral\Tests\Filters\Model\AttributeTestCase
{
public function testGetsValue(): void
{
diff --git a/src/Filters/tests/Model/Attribute/NestedFilterTest.php b/src/Filters/tests/Model/Attribute/NestedFilterTest.php
index 3eb8d4c75..8c5796d40 100644
--- a/src/Filters/tests/Model/Attribute/NestedFilterTest.php
+++ b/src/Filters/tests/Model/Attribute/NestedFilterTest.php
@@ -6,7 +6,7 @@
use Spiral\Filters\Attribute\NestedFilter;
-final class NestedFilterTest extends \Spiral\Tests\Filters\Model\AttributeTest
+final class NestedFilterTest extends \Spiral\Tests\Filters\Model\AttributeTestCase
{
public function testGetsSchemaWithPrefix(): void
{
diff --git a/src/Filters/tests/Model/Attribute/SetterTest.php b/src/Filters/tests/Model/Attribute/SetterTest.php
index ebb279262..ed1cd5528 100644
--- a/src/Filters/tests/Model/Attribute/SetterTest.php
+++ b/src/Filters/tests/Model/Attribute/SetterTest.php
@@ -6,7 +6,7 @@
use Spiral\Filters\Attribute\Setter;
-final class SetterTest extends \Spiral\Tests\Filters\Model\AttributeTest
+final class SetterTest extends \Spiral\Tests\Filters\Model\AttributeTestCase
{
public function testFilter(): void
{
diff --git a/src/Filters/tests/Model/AttributeTest.php b/src/Filters/tests/Model/AttributeTestCase.php
similarity index 86%
rename from src/Filters/tests/Model/AttributeTest.php
rename to src/Filters/tests/Model/AttributeTestCase.php
index afcce4f22..1aeae3a1c 100644
--- a/src/Filters/tests/Model/AttributeTest.php
+++ b/src/Filters/tests/Model/AttributeTestCase.php
@@ -7,7 +7,7 @@
use Mockery as m;
use Spiral\Filters\InputInterface;
-abstract class AttributeTest extends m\Adapter\Phpunit\MockeryTestCase
+abstract class AttributeTestCase extends m\Adapter\Phpunit\MockeryTestCase
{
protected m\LegacyMockInterface|m\MockInterface|InputInterface $input;
protected string $baz;
diff --git a/src/Filters/tests/Model/FilterBagTest.php b/src/Filters/tests/Model/FilterBagTest.php
index b1655c1f3..9ba3ab03e 100644
--- a/src/Filters/tests/Model/FilterBagTest.php
+++ b/src/Filters/tests/Model/FilterBagTest.php
@@ -8,9 +8,9 @@
use Spiral\Filters\Model\FilterBag;
use Spiral\Filters\Model\FilterInterface;
use Spiral\Models\AbstractEntity;
-use Spiral\Tests\Filters\BaseTest;
+use Spiral\Tests\Filters\BaseTestCase;
-final class FilterBagTest extends BaseTest
+final class FilterBagTest extends BaseTestCase
{
public function testBagShouldBeCreated(): void
{
diff --git a/src/Filters/tests/Model/FilterProviderTest.php b/src/Filters/tests/Model/FilterProviderTest.php
index 3d7eeaf33..8eeae2dae 100644
--- a/src/Filters/tests/Model/FilterProviderTest.php
+++ b/src/Filters/tests/Model/FilterProviderTest.php
@@ -13,11 +13,11 @@
use Spiral\Filters\Model\Interceptor\Core;
use Spiral\Filters\Model\Schema\AttributeMapper;
use Spiral\Http\Request\InputManager;
-use Spiral\Tests\Filters\BaseTest;
+use Spiral\Tests\Filters\BaseTestCase;
use Spiral\Tests\Filters\Fixtures\LogoutFilter;
use Spiral\Tests\Filters\Fixtures\SomeFilter;
-final class FilterProviderTest extends BaseTest
+final class FilterProviderTest extends BaseTestCase
{
public function testCreateNestedFilterWithIdenticalPropertyNames(): void
{
diff --git a/src/Filters/tests/Model/Interceptor/CoreTest.php b/src/Filters/tests/Model/Interceptor/CoreTest.php
index a53ae591e..441ec263d 100644
--- a/src/Filters/tests/Model/Interceptor/CoreTest.php
+++ b/src/Filters/tests/Model/Interceptor/CoreTest.php
@@ -9,9 +9,9 @@
use Spiral\Filters\Model\FilterInterface;
use Spiral\Filters\Model\Interceptor\Core;
use Spiral\Models\AbstractEntity;
-use Spiral\Tests\Filters\BaseTest;
+use Spiral\Tests\Filters\BaseTestCase;
-final class CoreTest extends BaseTest
+final class CoreTest extends BaseTestCase
{
public function testCall(): void
{
diff --git a/src/Filters/tests/Model/Interceptor/PopulateDataFromEntityInterceptorTest.php b/src/Filters/tests/Model/Interceptor/PopulateDataFromEntityInterceptorTest.php
index 9cab9be82..8ef50c0cc 100644
--- a/src/Filters/tests/Model/Interceptor/PopulateDataFromEntityInterceptorTest.php
+++ b/src/Filters/tests/Model/Interceptor/PopulateDataFromEntityInterceptorTest.php
@@ -11,9 +11,9 @@
use Spiral\Filters\Model\FilterInterface;
use Spiral\Filters\Model\Interceptor\PopulateDataFromEntityInterceptor;
use Spiral\Models\AbstractEntity;
-use Spiral\Tests\Filters\BaseTest;
+use Spiral\Tests\Filters\BaseTestCase;
-final class PopulateDataFromEntityInterceptorTest extends BaseTest
+final class PopulateDataFromEntityInterceptorTest extends BaseTestCase
{
private PopulateDataFromEntityInterceptor $interceptor;
diff --git a/src/Filters/tests/Model/Interceptor/ValidateFilterInterceptorTest.php b/src/Filters/tests/Model/Interceptor/ValidateFilterInterceptorTest.php
index 905264103..c3c88edfb 100644
--- a/src/Filters/tests/Model/Interceptor/ValidateFilterInterceptorTest.php
+++ b/src/Filters/tests/Model/Interceptor/ValidateFilterInterceptorTest.php
@@ -15,12 +15,12 @@
use Spiral\Filters\Model\ShouldBeValidated;
use Spiral\Filters\Exception\ValidationException;
use Spiral\Models\AbstractEntity;
-use Spiral\Tests\Filters\BaseTest;
+use Spiral\Tests\Filters\BaseTestCase;
use Spiral\Validation\ValidationInterface;
use Spiral\Validation\ValidationProviderInterface;
use Spiral\Validation\ValidatorInterface;
-final class ValidateFilterInterceptorTest extends BaseTest
+final class ValidateFilterInterceptorTest extends BaseTestCase
{
private ValidateFilterInterceptor $interceptor;
private m\MockInterface $validationProvider;
diff --git a/src/Filters/tests/Model/Schema/AttributeMapperTest.php b/src/Filters/tests/Model/Schema/AttributeMapperTest.php
index b6443afd5..9f47435ca 100644
--- a/src/Filters/tests/Model/Schema/AttributeMapperTest.php
+++ b/src/Filters/tests/Model/Schema/AttributeMapperTest.php
@@ -18,9 +18,9 @@
use Spiral\Filters\Model\Schema\AttributeMapper;
use Spiral\Filters\Exception\ValidationException;
use Spiral\Filters\InputInterface;
-use Spiral\Tests\Filters\BaseTest;
+use Spiral\Tests\Filters\BaseTestCase;
-final class AttributeMapperTest extends BaseTest
+final class AttributeMapperTest extends BaseTestCase
{
private m\LegacyMockInterface|m\MockInterface|FilterProviderInterface $provider;
private AttributeMapper $mapper;
diff --git a/src/Filters/tests/Model/Schema/BuilderTest.php b/src/Filters/tests/Model/Schema/BuilderTest.php
index a94bf3295..7f45f6fed 100644
--- a/src/Filters/tests/Model/Schema/BuilderTest.php
+++ b/src/Filters/tests/Model/Schema/BuilderTest.php
@@ -6,10 +6,10 @@
use Spiral\Filters\Model\Schema\Builder;
use Spiral\Filters\Exception\SchemaException;
-use Spiral\Tests\Filters\BaseTest;
+use Spiral\Tests\Filters\BaseTestCase;
use Spiral\Tests\Filters\Fixtures\NestedFilter;
-final class BuilderTest extends BaseTest
+final class BuilderTest extends BaseTestCase
{
private Builder $builder;
@@ -87,7 +87,7 @@ public function testBuildSchema(): void
public function testUndefinedSchema(): void
{
$this->expectException(SchemaException::class);
- $this->expectErrorMessage('Filter `foo` does not define any schema');
+ $this->expectExceptionMessage('Filter `foo` does not define any schema');
$this->builder->makeSchema('foo', []);
}
@@ -95,7 +95,7 @@ public function testUndefinedSchema(): void
public function testEmptySchema(): void
{
$this->expectException(SchemaException::class);
- $this->expectErrorMessage('Invalid schema definition at `foo`->`id`');
+ $this->expectExceptionMessage('Invalid schema definition at `foo`->`id`');
$this->builder->makeSchema('foo', ['id' => []]);
}
diff --git a/src/Filters/tests/Model/Schema/InputMapperTest.php b/src/Filters/tests/Model/Schema/InputMapperTest.php
index e99a577d8..1e55f6b8f 100644
--- a/src/Filters/tests/Model/Schema/InputMapperTest.php
+++ b/src/Filters/tests/Model/Schema/InputMapperTest.php
@@ -11,10 +11,10 @@
use Spiral\Filters\Model\Schema\InputMapper;
use Spiral\Filters\Exception\ValidationException;
use Spiral\Filters\InputInterface;
-use Spiral\Tests\Filters\BaseTest;
+use Spiral\Tests\Filters\BaseTestCase;
use Spiral\Tests\Filters\Fixtures\NestedFilter;
-final class InputMapperTest extends BaseTest
+final class InputMapperTest extends BaseTestCase
{
private m\LegacyMockInterface|m\MockInterface|FilterProviderInterface $provider;
private InputMapper $mapper;
diff --git a/src/Hmvc/composer.json b/src/Hmvc/composer.json
index caa3124aa..5f5473c67 100644
--- a/src/Hmvc/composer.json
+++ b/src/Hmvc/composer.json
@@ -32,7 +32,7 @@
"psr/event-dispatcher": "^1.0"
},
"require-dev": {
- "phpunit/phpunit": "^9.5.20",
+ "phpunit/phpunit": "^10.1",
"vimeo/psalm": "^5.9"
},
"autoload": {
diff --git a/src/Http/composer.json b/src/Http/composer.json
index 8d572cae4..e4fa27e46 100644
--- a/src/Http/composer.json
+++ b/src/Http/composer.json
@@ -41,7 +41,7 @@
},
"require-dev": {
"spiral/boot": "^3.8",
- "phpunit/phpunit": "^9.5.20",
+ "phpunit/phpunit": "^10.1",
"mockery/mockery": "^1.5",
"nyholm/psr7": "^1.5",
"vimeo/psalm": "^5.9"
diff --git a/src/Http/tests/AcceptHeaderItemTest.php b/src/Http/tests/AcceptHeaderItemTest.php
index 12a41cfa8..2cd9553e1 100644
--- a/src/Http/tests/AcceptHeaderItemTest.php
+++ b/src/Http/tests/AcceptHeaderItemTest.php
@@ -4,26 +4,21 @@
namespace Spiral\Tests\Http;
+use PHPUnit\Framework\Attributes\DataProvider;
use PHPUnit\Framework\TestCase;
use Spiral\Http\Header\AcceptHeader;
use Spiral\Http\Header\AcceptHeaderItem;
class AcceptHeaderItemTest extends TestCase
{
- /**
- * @dataProvider emptyItemProvider
- * @param AcceptHeaderItem $item
- */
+ #[DataProvider('emptyItemProvider')]
public function testEmptyItem(AcceptHeaderItem $item): void
{
$this->assertEmpty($item->getValue());
$this->assertEquals('', (string)$item);
}
- /**
- * @return iterable
- */
- public function emptyItemProvider(): iterable
+ public static function emptyItemProvider(): iterable
{
$values = ['', ' '];
foreach ($values as $value) {
@@ -35,10 +30,7 @@ public function emptyItemProvider(): iterable
}
}
- /**
- * @dataProvider valueProvider
- * @param string $value
- */
+ #[DataProvider('valueProvider')]
public function testValue(string $value): void
{
$item = AcceptHeaderItem::fromString($value);
@@ -55,24 +47,15 @@ public function testValue(string $value): void
$this->assertEquals($value, (string)$acceptHeader->getAll()[0]);
}
- /**
- * @return iterable
- */
- public function valueProvider(): iterable
+ public static function valueProvider(): \Traversable
{
- return [
- ['text/html'],
- ['text/*'],
- ['*/*'],
- ['*'],
- ];
+ yield ['text/html'];
+ yield ['text/*'];
+ yield ['*/*'];
+ yield ['*'];
}
- /**
- * @dataProvider qualityBoundariesProvider
- * @param float $quality
- * @param AcceptHeaderItem $item
- */
+ #[DataProvider('qualityBoundariesProvider')]
public function testItemQualityBoundaries(float $quality, AcceptHeaderItem $item): void
{
if ($quality > 1) {
@@ -87,10 +70,7 @@ public function testItemQualityBoundaries(float $quality, AcceptHeaderItem $item
$this->assertLessThanOrEqual(1, $item->getQuality());
}
- /**
- * @return iterable
- */
- public function qualityBoundariesProvider(): iterable
+ public static function qualityBoundariesProvider(): iterable
{
$qualities = [-1, 0, 0.5, 1, 2];
foreach ($qualities as $quality) {
@@ -103,20 +83,13 @@ public function qualityBoundariesProvider(): iterable
}
}
- /**
- * @dataProvider paramsProvider
- * @param array $params
- * @param AcceptHeaderItem $item
- */
+ #[DataProvider('paramsProvider')]
public function testParams(array $params, AcceptHeaderItem $item): void
{
$this->assertSame($params, $item->getParams());
}
- /**
- * @return iterable
- */
- public function paramsProvider(): iterable
+ public static function paramsProvider(): iterable
{
$set = [
[
@@ -156,20 +129,13 @@ public function paramsProvider(): iterable
];
}
- /**
- * @dataProvider itemProvider
- * @param string $expected
- * @param AcceptHeaderItem $item
- */
+ #[DataProvider('itemProvider')]
public function testItem(string $expected, AcceptHeaderItem $item): void
{
$this->assertSame($expected, (string)$item);
}
- /**
- * @return iterable
- */
- public function itemProvider(): iterable
+ public static function itemProvider(): iterable
{
$value = '*/*';
diff --git a/src/Http/tests/AcceptHeaderTest.php b/src/Http/tests/AcceptHeaderTest.php
index 3d3d04a45..2c36d96e6 100644
--- a/src/Http/tests/AcceptHeaderTest.php
+++ b/src/Http/tests/AcceptHeaderTest.php
@@ -4,6 +4,7 @@
namespace Spiral\Tests\Http;
+use PHPUnit\Framework\Attributes\DataProvider;
use PHPUnit\Framework\TestCase;
use Spiral\Http\Header\AcceptHeader;
use Spiral\Http\Header\AcceptHeaderItem;
@@ -42,12 +43,7 @@ public function testImmutability(): void
$this->assertSame('*/*', $header->add($secondItem)->getAll()[0]->getValue());
}
- /**
- * @dataProvider sameQualityCompareProvider
- * @param string $input
- * @param string $a
- * @param string $b
- */
+ #[DataProvider('sameQualityCompareProvider')]
public function testCompareWithEqualQuality(string $input, string $a, string $b): void
{
$headers = AcceptHeader::fromString($input)->getAll();
@@ -57,17 +53,12 @@ public function testCompareWithEqualQuality(string $input, string $a, string $b)
$this->assertEquals($b, $headers[1]->getValue());
}
- /**
- * @return iterable
- */
- public function sameQualityCompareProvider(): iterable
+ public static function sameQualityCompareProvider(): \Traversable
{
- return [
- ['text/css;q=0.3, text/html;q=0.3', 'text/css', 'text/html'],
- ['text/html;q=0.3, text/css;q=0.3', 'text/html', 'text/css'],
- ['text/html;q=1, text/css', 'text/html', 'text/css'],
- ['text/html, text/css;q=1', 'text/html', 'text/css'],
- ];
+ yield ['text/css;q=0.3, text/html;q=0.3', 'text/css', 'text/html'];
+ yield ['text/html;q=0.3, text/css;q=0.3', 'text/html', 'text/css'];
+ yield ['text/html;q=1, text/css', 'text/html', 'text/css'];
+ yield ['text/html, text/css;q=1', 'text/html', 'text/css'];
}
public function testDuplicatedItems(): void
@@ -89,12 +80,7 @@ public function testAccessor(): void
$this->assertSame('text/html; q=0.3', (string)$acceptHeader->get('text/html'));
}
- /**
- * @dataProvider addAndSortProvider
- * @param string $items
- * @param string $item
- * @param array $expected
- */
+ #[DataProvider('addAndSortProvider')]
public function testAddAndSort(string $items, string $item, array $expected): void
{
$acceptHeader = AcceptHeader::fromString($items);
@@ -108,40 +94,31 @@ public function testAddAndSort(string $items, string $item, array $expected): vo
}
}
- /**
- * @return iterable
- */
- public function addAndSortProvider(): iterable
+ public static function addAndSortProvider(): \Traversable
{
- return [
- [
- 'text/css;q=0.3,text/html;q=0.4',
- '',
- ['text/html', 'text/css']
- ],
- [
- 'text/css;q=0.3,text/html;q=0.4',
- 'text/javascript;q=0.35',
- ['text/html', 'text/javascript', 'text/css']
- ],
- [
- 'text/css;q=0.3,text/html;q=0.4',
- 'text/javascript;q=0.5',
- ['text/javascript', 'text/html', 'text/css']
- ],
- [
- 'text/css;q=0.3,text/html;q=0.4',
- 'text/javascript;q=.25',
- ['text/html', 'text/css', 'text/javascript']
- ],
+ yield [
+ 'text/css;q=0.3,text/html;q=0.4',
+ '',
+ ['text/html', 'text/css']
+ ];
+ yield [
+ 'text/css;q=0.3,text/html;q=0.4',
+ 'text/javascript;q=0.35',
+ ['text/html', 'text/javascript', 'text/css']
+ ];
+ yield [
+ 'text/css;q=0.3,text/html;q=0.4',
+ 'text/javascript;q=0.5',
+ ['text/javascript', 'text/html', 'text/css']
+ ];
+ yield [
+ 'text/css;q=0.3,text/html;q=0.4',
+ 'text/javascript;q=.25',
+ ['text/html', 'text/css', 'text/javascript']
];
}
- /**
- * @dataProvider compareProvider
- * @param string $items
- * @param array $expected
- */
+ #[DataProvider('compareProvider')]
public function testCompare(string $items, array $expected): void
{
$acceptHeader = AcceptHeader::fromString($items);
@@ -154,41 +131,36 @@ public function testCompare(string $items, array $expected): void
}
}
- /**
- * @return iterable
- */
- public function compareProvider(): iterable
+ public static function compareProvider(): \Traversable
{
- return [
- //quality based
- ['text/html;q=0.8, text/css;q=0.9', ['text/css; q=0.9', 'text/html; q=0.8']],
- ['text/*;q=0.9, text/css;q=0.8;a=b;c=d', ['text/*; q=0.9', 'text/css; q=0.8; a=b; c=d']],
- ['text/html;q=1, text/*;', ['text/html', 'text/*']],
- ['text/html, text/css;q=1', ['text/html', 'text/css']],
-
- //.../subType based
- ['text/html, text/css', ['text/html', 'text/css']],
- ['text/css, text/html', ['text/css', 'text/html']],
- ['text/*, text/html', ['text/html', 'text/*']],
- ['text/html, text/*', ['text/html', 'text/*']],
-
- //type/... based
- ['text/html, */css', ['text/html', '*/css']],
- ['*/css,text/html', ['text/html', '*/css']],
-
- //value based
- ['text/*, text', ['text/*', 'text']],
- ['text, */*', ['text', '*/*']],
- ['text, *', ['text', '*']],
- ['*/*, text', ['text', '*/*']],
- ['*, text', ['text', '*']],
- ['*, */*', ['*', '*/*']],
- ['*/*,*', ['*/*', '*']],
- ['*,*', ['*']],
-
- //params count based
- ['text-html, text-css;a=b;c=d', ['text-css; a=b; c=d', 'text-html']],
- ['text-html;a=b;c=d;e=f, text-css;a=b;c=d', ['text-html; a=b; c=d; e=f', 'text-css; a=b; c=d']],
- ];
+ //quality based
+ yield ['text/html;q=0.8, text/css;q=0.9', ['text/css; q=0.9', 'text/html; q=0.8']];
+ yield ['text/*;q=0.9, text/css;q=0.8;a=b;c=d', ['text/*; q=0.9', 'text/css; q=0.8; a=b; c=d']];
+ yield ['text/html;q=1, text/*;', ['text/html', 'text/*']];
+ yield ['text/html, text/css;q=1', ['text/html', 'text/css']];
+
+ //.../subType based
+ yield ['text/html, text/css', ['text/html', 'text/css']];
+ yield ['text/css, text/html', ['text/css', 'text/html']];
+ yield ['text/*, text/html', ['text/html', 'text/*']];
+ yield ['text/html, text/*', ['text/html', 'text/*']];
+
+ //type/... based
+ yield ['text/html, */css', ['text/html', '*/css']];
+ yield ['*/css,text/html', ['text/html', '*/css']];
+
+ //value based
+ yield ['text/*, text', ['text/*', 'text']];
+ yield ['text, */*', ['text', '*/*']];
+ yield ['text, *', ['text', '*']];
+ yield ['*/*, text', ['text', '*/*']];
+ yield ['*, text', ['text', '*']];
+ yield ['*, */*', ['*', '*/*']];
+ yield ['*/*,*', ['*/*', '*']];
+ yield ['*,*', ['*']];
+
+ //params count based
+ yield ['text-html, text-css;a=b;c=d', ['text-css; a=b; c=d', 'text-html']];
+ yield ['text-html;a=b;c=d;e=f, text-css;a=b;c=d', ['text-html; a=b; c=d; e=f', 'text-css; a=b; c=d']];
}
}
diff --git a/src/Http/tests/ExceptionsTest.php b/src/Http/tests/ExceptionsTest.php
index 7dfb15498..895995f36 100644
--- a/src/Http/tests/ExceptionsTest.php
+++ b/src/Http/tests/ExceptionsTest.php
@@ -4,6 +4,7 @@
namespace Spiral\Tests\Http;
+use PHPUnit\Framework\Attributes\DataProvider;
use PHPUnit\Framework\TestCase;
use Spiral\Http\Exception;
use Spiral\Http\Exception\ClientException;
@@ -12,7 +13,6 @@
use Spiral\Http\Exception\ClientException\NotFoundException;
use Spiral\Http\Exception\ClientException\ServerErrorException;
use Spiral\Http\Exception\ClientException\UnauthorizedException;
-use Spiral\Http\Exception\HttpException;
class ExceptionsTest extends TestCase
{
@@ -52,15 +52,13 @@ public function testServerError(): void
$this->assertSame(500, $e->getCode());
}
- /**
- * @dataProvider allExceptionsWithPreviousSet
- */
+ #[DataProvider('allExceptionsWithPreviousSet')]
public function testPreviousSetter(\Throwable $exception): void
{
$this->assertInstanceOf(\Throwable::class, $exception->getPrevious());
}
- public function allExceptionsWithPreviousSet(): \Generator
+ public static function allExceptionsWithPreviousSet(): \Generator
{
yield [new Exception\ClientException\BadRequestException('', new \Exception())];
yield [new Exception\ClientException\ForbiddenException('', new \Exception())];
diff --git a/src/Http/tests/InputManagerTest.php b/src/Http/tests/InputManagerTest.php
index 9d4b84aec..acfe5233f 100644
--- a/src/Http/tests/InputManagerTest.php
+++ b/src/Http/tests/InputManagerTest.php
@@ -4,6 +4,7 @@
namespace Spiral\Tests\Http\Request;
+use PHPUnit\Framework\Attributes\DataProvider;
use PHPUnit\Framework\TestCase;
use Psr\Http\Message\ServerRequestInterface;
use Spiral\Core\Container;
@@ -165,11 +166,7 @@ public function testIsXmlHttpRequest(): void
$this->assertTrue($this->input->isXmlHttpRequest());
}
- /**
- * @dataProvider isJsonExpectedProvider
- * @param bool $expected
- * @param string|null $acceptHeader
- */
+ #[DataProvider('isJsonExpectedProvider')]
public function testIsJsonExpected(bool $expected, ?string $acceptHeader): void
{
$input = $this->input->withJsonType('application/vnd.api+json');
@@ -185,24 +182,15 @@ public function testIsJsonExpected(bool $expected, ?string $acceptHeader): void
$this->assertSame($expected, $input->isJsonExpected());
}
- /**
- * @return iterable
- */
- public function isJsonExpectedProvider(): iterable
+ public static function isJsonExpectedProvider(): \Traversable
{
- return [
- [false, null],
- [false, 'text/html'],
- [true, 'application/json'],
- [true, 'application/vnd.api+json'],
- ];
+ yield [false, null];
+ yield [false, 'text/html'];
+ yield [true, 'application/json'];
+ yield [true, 'application/vnd.api+json'];
}
- /**
- * @dataProvider isJsonExpectedOnSoftMatchProvider
- * @param bool $expected
- * @param string|null $acceptHeader
- */
+ #[DataProvider('isJsonExpectedOnSoftMatchProvider')]
public function testIsJsonExpectedOnSoftMatch(bool $expected, ?string $acceptHeader): void
{
$request = new ServerRequest(
@@ -217,17 +205,12 @@ public function testIsJsonExpectedOnSoftMatch(bool $expected, ?string $acceptHea
$this->assertSame($expected, $this->input->isJsonExpected(true));
}
- /**
- * @return iterable
- */
- public function isJsonExpectedOnSoftMatchProvider(): iterable
+ public static function isJsonExpectedOnSoftMatchProvider(): \Traversable
{
- return [
- [false, null],
- [false, 'text/html'],
- [true, 'text/json'],
- [true, 'application/vnd.api+json'],
- ];
+ yield [false, null];
+ yield [false, 'text/html'];
+ yield [true, 'text/json'];
+ yield [true, 'application/vnd.api+json'];
}
public function testRemoteIP(): void
diff --git a/src/Http/tests/Middleware/ErrorHandlerMiddlewareTest.php b/src/Http/tests/Middleware/ErrorHandlerMiddlewareTest.php
index 07d1a33ab..b4e5fc394 100644
--- a/src/Http/tests/Middleware/ErrorHandlerMiddlewareTest.php
+++ b/src/Http/tests/Middleware/ErrorHandlerMiddlewareTest.php
@@ -6,6 +6,7 @@
use Nyholm\Psr7\Factory\Psr17Factory;
use Nyholm\Psr7\ServerRequest;
+use PHPUnit\Framework\Attributes\DataProvider;
use PHPUnit\Framework\TestCase;
use Psr\Http\Message\ServerRequestInterface;
use Psr\Http\Server\RequestHandlerInterface;
@@ -37,9 +38,7 @@ protected function setUp(): void
$this->renderer = $this->createMock(RendererInterface::class);
}
- /**
- * @dataProvider exceptionsDataProvider
- */
+ #[DataProvider('exceptionsDataProvider')]
public function testHandleExceptionWithDebugFalse(\Throwable $e, int $code): void
{
$this->handler
@@ -78,9 +77,7 @@ public function testHandleExceptionWithDebugFalse(\Throwable $e, int $code): voi
$middleware->process($this->request, $this->handler);
}
- /**
- * @dataProvider exceptionsDataProvider
- */
+ #[DataProvider('exceptionsDataProvider')]
public function testHandleExceptionWithDebugTrue(\Throwable $e, int $code): void
{
$renderer = $this->createMock(ExceptionRendererInterface::class);
@@ -127,9 +124,7 @@ public function testHandleExceptionWithDebugTrue(\Throwable $e, int $code): void
$this->assertSame($code, $response->getStatusCode());
}
- /**
- * @dataProvider exceptionsDataProvider
- */
+ #[DataProvider('exceptionsDataProvider')]
public function testHandleExceptionWithDefaultVerbosity(\Throwable $e, int $code): void
{
$renderer = $this->createMock(ExceptionRendererInterface::class);
@@ -175,7 +170,7 @@ public function testHandleExceptionWithDefaultVerbosity(\Throwable $e, int $code
$this->assertSame($code, $response->getStatusCode());
}
- public function exceptionsDataProvider(): \Traversable
+ public static function exceptionsDataProvider(): \Traversable
{
yield [new ClientException(message: 'some error'), 400];
yield [new RouterException(message: 'some error'), 404];
diff --git a/src/Http/tests/Request/InputBagTest.php b/src/Http/tests/Request/InputBagTest.php
index ce7dbcd2f..398086af6 100644
--- a/src/Http/tests/Request/InputBagTest.php
+++ b/src/Http/tests/Request/InputBagTest.php
@@ -126,7 +126,7 @@ public function testGetWithPrefix(): void
public function testSet(): void
{
$this->expectException(InputException::class);
- $this->expectErrorMessage('InputBag is immutable');
+ $this->expectExceptionMessage('InputBag is immutable');
$bag = new InputBag([1 => 'bar']);
$bag[1] = 'foo';
}
@@ -134,7 +134,7 @@ public function testSet(): void
public function testUnset(): void
{
$this->expectException(InputException::class);
- $this->expectErrorMessage('InputBag is immutable');
+ $this->expectExceptionMessage('InputBag is immutable');
$bag = new InputBag([1 => 'bar']);
unset($bag[1]);
}
diff --git a/src/Http/tests/Stream/GeneratorStreamTest.php b/src/Http/tests/Stream/GeneratorStreamTest.php
index 3fa141e98..b32767dd6 100644
--- a/src/Http/tests/Stream/GeneratorStreamTest.php
+++ b/src/Http/tests/Stream/GeneratorStreamTest.php
@@ -126,7 +126,7 @@ public function testUnableReadStream(): void
$this->assertSame('', (string) $stream);
$this->expectException(RuntimeException::class);
- $this->expectErrorMessage('Unable to read stream contents.');
+ $this->expectExceptionMessage('Unable to read stream contents.');
$stream->getContents();
}
@@ -137,7 +137,7 @@ public function testClose(): void
$stream->close();
$this->expectException(RuntimeException::class);
- $this->expectErrorMessage('Cannot read from non-readable stream.');
+ $this->expectExceptionMessage('Cannot read from non-readable stream.');
$stream->read(1);
diff --git a/src/Logger/composer.json b/src/Logger/composer.json
index dbb29f610..c6f2915ae 100644
--- a/src/Logger/composer.json
+++ b/src/Logger/composer.json
@@ -32,7 +32,7 @@
"spiral/core": "^3.8"
},
"require-dev": {
- "phpunit/phpunit": "^9.5.20",
+ "phpunit/phpunit": "^10.1",
"mockery/mockery": "^1.5",
"vimeo/psalm": "^5.9"
},
diff --git a/src/Mailer/composer.json b/src/Mailer/composer.json
index d9f0e2d11..127d3db62 100644
--- a/src/Mailer/composer.json
+++ b/src/Mailer/composer.json
@@ -30,7 +30,7 @@
"php": ">=8.1"
},
"require-dev": {
- "phpunit/phpunit": "^9.5.20",
+ "phpunit/phpunit": "^10.1",
"mockery/mockery": "^1.5",
"vimeo/psalm": "^5.9"
},
diff --git a/src/Models/composer.json b/src/Models/composer.json
index 24531b500..ed3f00091 100644
--- a/src/Models/composer.json
+++ b/src/Models/composer.json
@@ -30,7 +30,7 @@
"php": ">=8.1"
},
"require-dev": {
- "phpunit/phpunit": "^9.5.20",
+ "phpunit/phpunit": "^10.1",
"mockery/mockery": "^1.5",
"vimeo/psalm": "^5.9"
},
diff --git a/src/Pagination/composer.json b/src/Pagination/composer.json
index 764f027c4..110db7980 100644
--- a/src/Pagination/composer.json
+++ b/src/Pagination/composer.json
@@ -30,7 +30,7 @@
"php": ">=8.1"
},
"require-dev": {
- "phpunit/phpunit": "^9.5.20",
+ "phpunit/phpunit": "^10.1",
"mockery/mockery": "^1.5",
"vimeo/psalm": "^5.9"
},
diff --git a/src/Prototype/composer.json b/src/Prototype/composer.json
index 8b040acf8..3e777b020 100644
--- a/src/Prototype/composer.json
+++ b/src/Prototype/composer.json
@@ -40,7 +40,7 @@
},
"require-dev": {
"mockery/mockery": "^1.5",
- "phpunit/phpunit": "^9.5.20",
+ "phpunit/phpunit": "^10.1",
"spiral/framework": "^3.1",
"vimeo/psalm": "^5.9"
},
diff --git a/src/Prototype/src/Traits/PrototypeTrait.php b/src/Prototype/src/Traits/PrototypeTrait.php
index 2b6c1ffec..3f9d4afa0 100644
--- a/src/Prototype/src/Traits/PrototypeTrait.php
+++ b/src/Prototype/src/Traits/PrototypeTrait.php
@@ -11,41 +11,6 @@
/**
* This DocComment is auto-generated, do not edit or commit this file to repository.
- *
- * @property \Spiral\App\TestApp $app
- * @property \Spiral\Tokenizer\ClassesInterface $classLocator
- * @property \Spiral\Console\Console $console
- * @property \Spiral\Broadcasting\BroadcastInterface $broadcast
- * @property \Psr\Container\ContainerInterface $container
- * @property \Spiral\Encrypter\EncrypterInterface $encrypter
- * @property \Spiral\Boot\EnvironmentInterface $env
- * @property \Spiral\Files\FilesInterface $files
- * @property \Spiral\Security\GuardInterface $guard
- * @property \Spiral\Http\Http $http
- * @property \Spiral\Translator\TranslatorInterface $i18n
- * @property \Spiral\Http\Request\InputManager $input
- * @property \Spiral\Session\SessionScope $session
- * @property \Spiral\Cookies\CookieManager $cookies
- * @property \Psr\Log\LoggerInterface $logger
- * @property \Spiral\Logger\LogsInterface $logs
- * @property \Spiral\Boot\MemoryInterface $memory
- * @property \Spiral\Pagination\PaginationProviderInterface $paginators
- * @property \Spiral\Queue\QueueInterface $queue
- * @property \Spiral\Queue\QueueConnectionProviderInterface $queueManager
- * @property \Spiral\Http\Request\InputManager $request
- * @property \Spiral\Http\ResponseWrapper $response
- * @property \Spiral\Router\RouterInterface $router
- * @property \Spiral\Snapshots\SnapshotterInterface $snapshots
- * @property \Spiral\Storage\BucketInterface $storage
- * @property \Spiral\Serializer\SerializerManager $serializer
- * @property \Spiral\Validation\ValidationInterface $validator
- * @property \Spiral\Views\ViewsInterface $views
- * @property \Spiral\Auth\AuthScope $auth
- * @property \Spiral\Auth\TokenStorageInterface $authTokens
- * @property \Psr\SimpleCache\CacheInterface $cache
- * @property \Spiral\Cache\CacheStorageProviderInterface $cacheManager
- * @property \Spiral\Exceptions\ExceptionHandlerInterface $exceptionHandler
- * @property \Spiral\App\SomeService\Client $service.client
*/
trait PrototypeTrait
{
diff --git a/src/Prototype/tests/ClassNode/ConflictResolver/ConflictResolverTest.php b/src/Prototype/tests/ClassNode/ConflictResolver/ConflictResolverTest.php
index e5e2dd923..35f70c92c 100644
--- a/src/Prototype/tests/ClassNode/ConflictResolver/ConflictResolverTest.php
+++ b/src/Prototype/tests/ClassNode/ConflictResolver/ConflictResolverTest.php
@@ -30,21 +30,21 @@ public function testResolveInternalConflicts(): void
$this->getDefinition(
$filename,
[
- 'test' => Fixtures\Test::class,
- 'test2' => Fixtures\SubFolder\Test::class,
+ 'test' => Fixtures\Some::class,
+ 'test2' => Fixtures\SubFolder\Some::class,
'test3' => Fixtures\ATest3::class,
]
)
);
- $this->assertStringContainsString(Fixtures\Test::class . ';', $r);
- $this->assertRegExp('/@var Test[\s|\r\n]/', $r);
- $this->assertStringContainsString('@param Test $test', $r);
+ $this->assertStringContainsString(Fixtures\Some::class . ';', $r);
+ $this->assertRegExp('/@var Some[\s|\r\n]/', $r);
+ $this->assertStringContainsString('@param Some $test', $r);
- $this->assertStringContainsString(Fixtures\SubFolder\Test::class . ' as Test2;', $r);
- $this->assertStringNotContainsString(Fixtures\SubFolder\Test::class . ';', $r);
- $this->assertRegExp('/@var Test2[\s|\r\n]/', $r);
- $this->assertStringContainsString('@param Test2 $test2', $r);
+ $this->assertStringContainsString(Fixtures\SubFolder\Some::class . ' as Some2;', $r);
+ $this->assertStringNotContainsString(Fixtures\SubFolder\Some::class . ';', $r);
+ $this->assertRegExp('/@var Some2[\s|\r\n]/', $r);
+ $this->assertStringContainsString('@param Some2 $test2', $r);
$this->assertStringContainsString(Fixtures\ATest3::class . ';', $r);
$this->assertRegExp('/@var ATest3[\s|\r\n]/', $r);
@@ -64,20 +64,20 @@ public function testResolveImportConflicts(): void
$this->getDefinition(
$filename,
[
- 'test' => Fixtures\Test::class,
- 'test2' => Fixtures\SubFolder\Test::class,
+ 'test' => Fixtures\Some::class,
+ 'test2' => Fixtures\SubFolder\Some::class,
'test3' => Fixtures\ATest3::class,
]
)
);
- $this->assertStringContainsString(Fixtures\Test::class . ' as FTest;', $r);
- $this->assertStringNotContainsString(Fixtures\Test::class . ';', $r);
+ $this->assertStringContainsString(Fixtures\Some::class . ' as FTest;', $r);
+ $this->assertStringNotContainsString(Fixtures\Some::class . ';', $r);
$this->assertRegExp('/@var FTest[\s|\r\n]/', $r);
$this->assertStringContainsString('@param FTest $test', $r);
- $this->assertStringContainsString(Fixtures\SubFolder\Test::class . ' as TestAlias;', $r);
- $this->assertStringNotContainsString(Fixtures\SubFolder\Test::class . ';', $r);
+ $this->assertStringContainsString(Fixtures\SubFolder\Some::class . ' as TestAlias;', $r);
+ $this->assertStringNotContainsString(Fixtures\SubFolder\Some::class . ';', $r);
$this->assertRegExp('/@var TestAlias[\s|\r\n]/', $r);
$this->assertStringContainsString('@param TestAlias $test2', $r);
@@ -100,21 +100,21 @@ public function testResolveWithAliasForParentConstructor(): void
$this->getDefinition(
$filename,
[
- 'test' => Fixtures\Test::class,
- 'test2' => Fixtures\SubFolder\Test::class,
+ 'test' => Fixtures\Some::class,
+ 'test2' => Fixtures\SubFolder\Some::class,
'test3' => Fixtures\ATest3::class,
]
)
);
- $this->assertStringContainsString(Fixtures\Test::class . ';', $r);
- $this->assertRegExp('/@var Test[\s|\r\n]/', $r);
- $this->assertStringContainsString('@param Test $test', $r);
+ $this->assertStringContainsString(Fixtures\Some::class . ';', $r);
+ $this->assertRegExp('/@var Some[\s|\r\n]/', $r);
+ $this->assertStringContainsString('@param Some $test', $r);
- $this->assertStringContainsString(Fixtures\SubFolder\Test::class . ' as Test2;', $r);
- $this->assertStringNotContainsString(Fixtures\SubFolder\Test::class . ';', $r);
- $this->assertRegExp('/@var Test2[\s|\r\n]/', $r);
- $this->assertStringContainsString('@param Test2 $test2', $r);
+ $this->assertStringContainsString(Fixtures\SubFolder\Some::class . ' as Some2;', $r);
+ $this->assertStringNotContainsString(Fixtures\SubFolder\Some::class . ';', $r);
+ $this->assertRegExp('/@var Some2[\s|\r\n]/', $r);
+ $this->assertStringContainsString('@param Some2 $test2', $r);
$this->assertStringContainsString(Fixtures\ATest3::class . ' as ATestAlias;', $r);
$this->assertStringNotContainsString(Fixtures\ATest3::class . ';', $r);
@@ -132,15 +132,15 @@ public function testDuplicateProperty(): void
$this->getDefinition(
$filename,
[
- 'test' => Fixtures\Test::class,
+ 'test' => Fixtures\Some::class,
]
)
);
- $this->assertStringContainsString(Fixtures\Test::class . ';', $r);
- $this->assertRegExp('/@var Test[\s|\r\n]/', $r);
- $this->assertStringContainsString('@param Test $test', $r);
- $this->assertStringContainsString('__construct(Test $test)', $r);
+ $this->assertStringContainsString(Fixtures\Some::class . ';', $r);
+ $this->assertRegExp('/@var Some[\s|\r\n]/', $r);
+ $this->assertStringContainsString('@param Some $test', $r);
+ $this->assertStringContainsString('__construct(Some $test)', $r);
}
/**
diff --git a/src/Prototype/tests/ClassNode/ConflictResolver/EntitiesTest.php b/src/Prototype/tests/ClassNode/ConflictResolver/EntitiesTest.php
index ae07555f2..52f2c5b0e 100644
--- a/src/Prototype/tests/ClassNode/ConflictResolver/EntitiesTest.php
+++ b/src/Prototype/tests/ClassNode/ConflictResolver/EntitiesTest.php
@@ -4,30 +4,23 @@
namespace Spiral\Tests\Prototype\ClassNode\ConflictResolver;
+use PHPUnit\Framework\Attributes\DataProvider;
use PHPUnit\Framework\TestCase;
use Spiral\Prototype\ClassNode\ConflictResolver\NameEntity;
class EntitiesTest extends TestCase
{
- /**
- * @dataProvider nameProvider
- *
- * @param string $name
- * @param int $sequence
- * @param string $expected
- */
+ #[DataProvider('nameProvider')]
public function testName(string $name, int $sequence, string $expected): void
{
$this->assertEquals($expected, NameEntity::createWithSequence($name, $sequence)->fullName());
}
- public function nameProvider(): array
+ public static function nameProvider(): \Traversable
{
- return [
- ['name', 7, 'name7'],
- ['name', 0, 'name'],
- ['name', -1, 'name'],
- ['name', 1, 'name1'],
- ];
+ yield ['name', 7, 'name7'];
+ yield ['name', 0, 'name'];
+ yield ['name', -1, 'name'];
+ yield ['name', 1, 'name1'];
}
}
diff --git a/src/Prototype/tests/ClassNode/ConflictResolver/Fixtures/Params.php b/src/Prototype/tests/ClassNode/ConflictResolver/Fixtures/Params.php
index 5a02933c1..a8a0a1543 100644
--- a/src/Prototype/tests/ClassNode/ConflictResolver/Fixtures/Params.php
+++ b/src/Prototype/tests/ClassNode/ConflictResolver/Fixtures/Params.php
@@ -24,24 +24,24 @@ public static function getParams(string $method): array
}
private function paramsSource(
- Test $t1,
- Test $t4,
+ Some $t1,
+ Some $t4,
?TestAlias $a1,
- SubFolder\Test $st = null,
+ SubFolder\Some $st = null,
string $str = 'value'
): void {
}
private function paramsSource2(
- Test $t1,
- Test $t4,
+ Some $t1,
+ Some $t4,
?TestAlias $a1,
- SubFolder\Test $st = null,
+ SubFolder\Some $st = null,
string $t2 = 'value'
): void {
}
- private function paramsSource3(Test $t, Test $t4, ?TestAlias $a1, SubFolder\Test $st = null): void
+ private function paramsSource3(Some $t, Some $t4, ?TestAlias $a1, SubFolder\Some $st = null): void
{
}
}
diff --git a/src/Prototype/tests/ClassNode/ConflictResolver/Fixtures/Test.php b/src/Prototype/tests/ClassNode/ConflictResolver/Fixtures/Some.php
similarity index 90%
rename from src/Prototype/tests/ClassNode/ConflictResolver/Fixtures/Test.php
rename to src/Prototype/tests/ClassNode/ConflictResolver/Fixtures/Some.php
index 5af41ba1e..d63342088 100644
--- a/src/Prototype/tests/ClassNode/ConflictResolver/Fixtures/Test.php
+++ b/src/Prototype/tests/ClassNode/ConflictResolver/Fixtures/Some.php
@@ -4,6 +4,6 @@
namespace Spiral\Tests\Prototype\ClassNode\ConflictResolver\Fixtures;
-class Test
+class Some
{
}
diff --git a/src/Prototype/tests/ClassNode/ConflictResolver/Fixtures/SubFolder/Test.php b/src/Prototype/tests/ClassNode/ConflictResolver/Fixtures/SubFolder/Some.php
similarity index 91%
rename from src/Prototype/tests/ClassNode/ConflictResolver/Fixtures/SubFolder/Test.php
rename to src/Prototype/tests/ClassNode/ConflictResolver/Fixtures/SubFolder/Some.php
index 53f84511a..dbbd16eec 100644
--- a/src/Prototype/tests/ClassNode/ConflictResolver/Fixtures/SubFolder/Test.php
+++ b/src/Prototype/tests/ClassNode/ConflictResolver/Fixtures/SubFolder/Some.php
@@ -4,6 +4,6 @@
namespace Spiral\Tests\Prototype\ClassNode\ConflictResolver\Fixtures\SubFolder;
-class Test
+class Some
{
}
diff --git a/src/Prototype/tests/ClassNode/ConflictResolver/Fixtures/TestClassWithImports.php b/src/Prototype/tests/ClassNode/ConflictResolver/Fixtures/TestClassWithImports.php
index 52a510b04..29cbc2374 100644
--- a/src/Prototype/tests/ClassNode/ConflictResolver/Fixtures/TestClassWithImports.php
+++ b/src/Prototype/tests/ClassNode/ConflictResolver/Fixtures/TestClassWithImports.php
@@ -5,8 +5,8 @@
namespace Spiral\Tests\Prototype\ClassNode\ConflictResolver\Fixtures;
//this is an alias which should be inserted as a dependency type
-use Spiral\Tests\Prototype\ClassNode\ConflictResolver\Fixtures\Test as FTest;
-use Spiral\Tests\Prototype\ClassNode\ConflictResolver\Fixtures\SubFolder\Test as TestAlias;
+use Spiral\Tests\Prototype\ClassNode\ConflictResolver\Fixtures\Some as FTest;
+use Spiral\Tests\Prototype\ClassNode\ConflictResolver\Fixtures\SubFolder\Some as TestAlias;
//
use Spiral\Tests\Prototype\ClassNode\ConflictResolver\Fixtures\TestAlias as ATest3;
use Spiral\Tests\Prototype\Fixtures\TestApp as Test;
diff --git a/src/Prototype/tests/ClassNode/ConflictResolver/Fixtures/WithComplexConstructor.php b/src/Prototype/tests/ClassNode/ConflictResolver/Fixtures/WithComplexConstructor.php
index 69acce05d..5726f86f6 100644
--- a/src/Prototype/tests/ClassNode/ConflictResolver/Fixtures/WithComplexConstructor.php
+++ b/src/Prototype/tests/ClassNode/ConflictResolver/Fixtures/WithComplexConstructor.php
@@ -15,7 +15,7 @@ public function __construct(
?string $str2,
?\StdClass $nullableClass1,
$untypedVarWithDefault = 3,
- ?Test $test1 = null,
+ ?Some $test1 = null,
?string $str3 = null,
?int $int = 123,
\StdClass $nullableClass2 = null,
diff --git a/src/Prototype/tests/ClassNode/ConflictResolver/NamesTest.php b/src/Prototype/tests/ClassNode/ConflictResolver/NamesTest.php
index 975e82980..cb834073b 100644
--- a/src/Prototype/tests/ClassNode/ConflictResolver/NamesTest.php
+++ b/src/Prototype/tests/ClassNode/ConflictResolver/NamesTest.php
@@ -4,6 +4,7 @@
namespace Spiral\Tests\Prototype\ClassNode\ConflictResolver;
+use PHPUnit\Framework\Attributes\DataProvider;
use PHPUnit\Framework\TestCase;
use Spiral\Core\Container;
use Spiral\Prototype\ClassNode;
@@ -13,15 +14,7 @@
class NamesTest extends TestCase
{
- /**
- * @dataProvider cdProvider
- *
- * @param string $method
- * @param array $vars
- * @param array $dependencies
- * @param array $expected
- * @throws \ReflectionException
- */
+ #[DataProvider('cdProvider')]
public function testFind(string $method, array $vars, array $dependencies, array $expected): void
{
$cd = ClassNode::create('class\name');
@@ -42,35 +35,33 @@ public function testFind(string $method, array $vars, array $dependencies, array
$this->assertEquals($expected, $resolved);
}
- public function cdProvider(): array
+ public static function cdProvider(): \Traversable
{
- return [
- [
- 'paramsSource',
- [],
- ['v2' => 'type1', 'v' => 'type2', 'vv' => 'type3',],
- ['v2', 'v', 'vv']
- ],
- [
- 'paramsSource',
- ['v', 'v2'],
- [
- 'v2' => 'type1',
- 'v' => 'type2',
- 'vv' => 'type3',
- 't1' => 'type4',
- 't2' => 'type4',
- 't4' => 'type4',
- 't6' => 'type4'
- ],
- ['v3', 'v4', 'vv', 't', 't2', 't3', 't6']
- ],
+ yield [
+ 'paramsSource',
+ [],
+ ['v2' => 'type1', 'v' => 'type2', 'vv' => 'type3',],
+ ['v2', 'v', 'vv']
+ ];
+ yield [
+ 'paramsSource',
+ ['v', 'v2'],
[
- 'paramsSource3',
- [],
- ['t' => 'type', 't3' => 'type3'],
- ['t2', 't3']
+ 'v2' => 'type1',
+ 'v' => 'type2',
+ 'vv' => 'type3',
+ 't1' => 'type4',
+ 't2' => 'type4',
+ 't4' => 'type4',
+ 't6' => 'type4'
],
+ ['v3', 'v4', 'vv', 't', 't2', 't3', 't6']
+ ];
+ yield [
+ 'paramsSource3',
+ [],
+ ['t' => 'type', 't3' => 'type3'],
+ ['t2', 't3']
];
}
diff --git a/src/Prototype/tests/ClassNode/ConflictResolver/NamespacesTest.php b/src/Prototype/tests/ClassNode/ConflictResolver/NamespacesTest.php
index a9ad69e85..cbeb91f10 100644
--- a/src/Prototype/tests/ClassNode/ConflictResolver/NamespacesTest.php
+++ b/src/Prototype/tests/ClassNode/ConflictResolver/NamespacesTest.php
@@ -4,6 +4,7 @@
namespace Spiral\Tests\Prototype\ClassNode\ConflictResolver;
+use PHPUnit\Framework\Attributes\DataProvider;
use PHPUnit\Framework\TestCase;
use Spiral\Core\Container;
use Spiral\Prototype\ClassNode;
@@ -13,14 +14,7 @@
class NamespacesTest extends TestCase
{
- /**
- * @dataProvider cdProvider
- *
- * @param array $stmts
- * @param array $dependencies
- * @param array $expected
- * @throws \ReflectionException
- */
+ #[DataProvider('cdProvider')]
public function testFind(array $stmts, array $dependencies, array $expected): void
{
$cd = ClassNode::create('class\name');
@@ -44,67 +38,65 @@ public function testFind(array $stmts, array $dependencies, array $expected): vo
$this->assertEquals($expected, $resolved);
}
- public function cdProvider(): array
+ public static function cdProvider(): \Traversable
{
- return [
+ yield [
+ //no conflicts
+ [],
[
- //no conflicts
- [],
- [
- 'v1' => 'a\\b\\c\\type1',
- 'v2' => 'a\\b\\type2',
- 'v3' => 'a\\b\\c\\type3'
- ],
- [
- 'v1' => 'type1',
- 'v2' => 'type2',
- 'v3' => 'type3'
- ]
+ 'v1' => 'a\\b\\c\\type1',
+ 'v2' => 'a\\b\\type2',
+ 'v3' => 'a\\b\\c\\type3'
],
[
- [
- 'Test' => 'a\\b\\Test',
- 'TestAlias' => 'a\\b\\Test',
- 'type1' => 'a\\b\\c\\type1',
- 'type2' => 'a\\b\\c\\type2',
- 'type7' => 'a\\b\\c\\type4',
- ],
- //has conflicts
- [
- 'v1' => 'a\\b\\c\\type1',
- 'v2' => 'a\\b\\type1',
- 'v3' => 'a\\b\\c\\type2',
- 'v4' => 'a\\b\\type2',
- 'v5' => 'a\\b\\c\\type7',
- 'v6' => 'a\\b\\c\\type4',
- 'v7' => 'a\\b\\type4',
- 'v8' => 'a\\b\\type5',
- ],
- [
- 'v1' => 'type1',
- 'v2' => 'type',
- 'v3' => 'type2',
- 'v4' => 'type3',
- 'v5' => 'type4',
- 'v6' => 'type7',
- 'v7' => 'type5',
- 'v8' => 'type6',
- ]
+ 'v1' => 'type1',
+ 'v2' => 'type2',
+ 'v3' => 'type3'
+ ]
+ ];
+ yield [
+ [
+ 'Test' => 'a\\b\\Test',
+ 'TestAlias' => 'a\\b\\Test',
+ 'type1' => 'a\\b\\c\\type1',
+ 'type2' => 'a\\b\\c\\type2',
+ 'type7' => 'a\\b\\c\\type4',
],
+ //has conflicts
[
- [],
- //has conflicts
- [
- 'v1' => 'a\\b\\type',
- 'v2' => 'a\\b\\c\\type',
- 'v3' => 'a\\b\\c\\type3',
- ],
- [
- 'v1' => 'type',
- 'v2' => 'type2',
- 'v3' => 'type3',
- ]
+ 'v1' => 'a\\b\\c\\type1',
+ 'v2' => 'a\\b\\type1',
+ 'v3' => 'a\\b\\c\\type2',
+ 'v4' => 'a\\b\\type2',
+ 'v5' => 'a\\b\\c\\type7',
+ 'v6' => 'a\\b\\c\\type4',
+ 'v7' => 'a\\b\\type4',
+ 'v8' => 'a\\b\\type5',
],
+ [
+ 'v1' => 'type1',
+ 'v2' => 'type',
+ 'v3' => 'type2',
+ 'v4' => 'type3',
+ 'v5' => 'type4',
+ 'v6' => 'type7',
+ 'v7' => 'type5',
+ 'v8' => 'type6',
+ ]
+ ];
+ yield [
+ [],
+ //has conflicts
+ [
+ 'v1' => 'a\\b\\type',
+ 'v2' => 'a\\b\\c\\type',
+ 'v3' => 'a\\b\\c\\type3',
+ ],
+ [
+ 'v1' => 'type',
+ 'v2' => 'type2',
+ 'v3' => 'type3',
+ ]
];
}
diff --git a/src/Prototype/tests/ClassNode/ConflictResolver/SequenceTest.php b/src/Prototype/tests/ClassNode/ConflictResolver/SequenceTest.php
index d9e7fc7f1..d995596fb 100644
--- a/src/Prototype/tests/ClassNode/ConflictResolver/SequenceTest.php
+++ b/src/Prototype/tests/ClassNode/ConflictResolver/SequenceTest.php
@@ -4,41 +4,34 @@
namespace Spiral\Tests\Prototype\ClassNode\ConflictResolver;
+use PHPUnit\Framework\Attributes\DataProvider;
use PHPUnit\Framework\TestCase;
use Spiral\Core\Container;
use Spiral\Prototype\ClassNode\ConflictResolver\Sequences;
class SequenceTest extends TestCase
{
- /**
- * @dataProvider findProvider
- *
- * @param array $sequence
- * @param int $pos
- * @param int $expected
- */
+ #[DataProvider('findProvider')]
public function testFind(array $sequence, int $pos, int $expected): void
{
$this->assertEquals($expected, $this->sequences()->find($sequence, $pos));
}
- public function findProvider(): array
+ public static function findProvider(): \Traversable
{
- return [
- // empty input
- [[], 5, 5],
- // in the gap (not taken)
- [[3, 4, 8, 9,], 6, 6],
- [[3, 4, 8, 9,], 1, 1],
- // in the sequence (taken)
- [[3, 4, 8, 9,], 4, 0],
- [[0, 1, 4, 5,], 5, 2],
- // do not use "1"
- [[0, 3, 4, 8,], 4, 2],
- // full sequence, take next
- [[0, 1, 2, 3,], 3, 4],
- [[0], 0, 2],
- ];
+ // empty input
+ yield [[], 5, 5];
+ // in the gap (not taken)
+ yield [[3, 4, 8, 9,], 6, 6];
+ yield [[3, 4, 8, 9,], 1, 1];
+ // in the sequence (taken)
+ yield [[3, 4, 8, 9,], 4, 0];
+ yield [[0, 1, 4, 5,], 5, 2];
+ // do not use "1"
+ yield [[0, 3, 4, 8,], 4, 2];
+ // full sequence, take next
+ yield [[0, 1, 2, 3,], 3, 4];
+ yield [[0], 0, 2];
}
private function sequences(): Sequences
diff --git a/src/Prototype/tests/Commands/AbstractCommandsTest.php b/src/Prototype/tests/Commands/AbstractCommandsTestCase.php
similarity index 96%
rename from src/Prototype/tests/Commands/AbstractCommandsTest.php
rename to src/Prototype/tests/Commands/AbstractCommandsTestCase.php
index 921438674..c87da7db1 100644
--- a/src/Prototype/tests/Commands/AbstractCommandsTest.php
+++ b/src/Prototype/tests/Commands/AbstractCommandsTestCase.php
@@ -9,7 +9,7 @@
use Spiral\Tests\Prototype\Fixtures\TestApp;
use Spiral\Tests\Prototype\Storage;
-abstract class AbstractCommandsTest extends TestCase
+abstract class AbstractCommandsTestCase extends TestCase
{
protected const STORE = [
'TestClass.php',
diff --git a/src/Prototype/tests/Commands/InjectCommandTest.php b/src/Prototype/tests/Commands/InjectCommandTest.php
index a64ffd7e5..fcfbefdb9 100644
--- a/src/Prototype/tests/Commands/InjectCommandTest.php
+++ b/src/Prototype/tests/Commands/InjectCommandTest.php
@@ -14,7 +14,7 @@
use Symfony\Component\Console\Input\ArrayInput;
use Symfony\Component\Console\Output\BufferedOutput;
-class InjectCommandTest extends AbstractCommandsTest
+class InjectCommandTest extends AbstractCommandsTestCase
{
public function testEmptyInjection(): void
{
diff --git a/src/Prototype/tests/Commands/ListCommandTest.php b/src/Prototype/tests/Commands/ListCommandTest.php
index daa83512b..5a7f674a8 100644
--- a/src/Prototype/tests/Commands/ListCommandTest.php
+++ b/src/Prototype/tests/Commands/ListCommandTest.php
@@ -9,7 +9,7 @@
use Symfony\Component\Console\Input\ArrayInput;
use Symfony\Component\Console\Output\BufferedOutput;
-class ListCommandTest extends AbstractCommandsTest
+class ListCommandTest extends AbstractCommandsTestCase
{
public function testList(): void
{
diff --git a/src/Prototype/tests/Fixtures/TestApp.php b/src/Prototype/tests/Fixtures/TestApp.php
index 4554571c8..e267ad0f4 100644
--- a/src/Prototype/tests/Fixtures/TestApp.php
+++ b/src/Prototype/tests/Fixtures/TestApp.php
@@ -33,8 +33,8 @@ public function bindWithoutResolver(): void
$registry = $this->container->get(PrototypeRegistry::class);
$registry->bindProperty('testClass', self::class);
- $registry->bindProperty('test', Fixtures\Test::class);
- $registry->bindProperty('test2', Fixtures\SubFolder\Test::class);
+ $registry->bindProperty('test', Fixtures\Some::class);
+ $registry->bindProperty('test2', Fixtures\SubFolder\Some::class);
$registry->bindProperty('test3', Fixtures\ATest3Interface::class);
$registry->bindProperty('one', InheritedInjection\InjectionOne::class);
$registry->bindProperty('two', InheritedInjection\InjectionTwo::class);
diff --git a/src/Prototype/tests/InjectorTest.php b/src/Prototype/tests/InjectorTest.php
index 50e3a99cc..2b8ec6281 100644
--- a/src/Prototype/tests/InjectorTest.php
+++ b/src/Prototype/tests/InjectorTest.php
@@ -4,6 +4,7 @@
namespace Spiral\Tests\Prototype;
+use PHPUnit\Framework\Attributes\DataProvider;
use PHPUnit\Framework\TestCase;
use Spiral\Core\Container;
use Spiral\Prototype\ClassNode;
@@ -42,15 +43,7 @@ public function testSimpleInjection(): void
$this->assertStringContainsString(TestClass::class, $printed);
}
- /**
- * @dataProvider typedProvider
- * @param bool $useTypedProperties
- * @param bool $noPhpDoc
- * @param bool $expectedTypedProperty
- * @param bool $expectedPhpDoc
- * @throws \ReflectionException
- * @throws ClassNotDeclaredException
- */
+ #[DataProvider('typedProvider')]
public function testTypedInjection(
bool $useTypedProperties,
bool $noPhpDoc,
@@ -81,14 +74,12 @@ public function testTypedInjection(
}
}
- public function typedProvider(): iterable
+ public static function typedProvider(): \Traversable
{
- return [
- [true, true, true, false],
- [true, false, true, true],
- [false, false, false, true],
- [false, true, false, true],
- ];
+ yield [true, true, true, false];
+ yield [true, false, true, true];
+ yield [false, false, false, true];
+ yield [false, true, false, true];
}
/**
@@ -239,8 +230,8 @@ public function testParentConstructorParamsTypeDefinition(): void
$this->getDefinition(
$filename,
[
- 'test' => ResolverFixtures\Test::class,
- 'test2' => ResolverFixtures\SubFolder\Test::class,
+ 'test' => ResolverFixtures\Some::class,
+ 'test2' => ResolverFixtures\SubFolder\Some::class,
'test3' => ResolverFixtures\ATest3::class,
]
)
@@ -292,8 +283,8 @@ public function testParentConstructorParamsTypeDefinition(): void
$this->assertFalse($parameters['nullableClass1']['optional']);
$this->assertArrayHasKey('test1', $parameters);
- $this->assertEquals('?Test', $parameters['test1']['type']);
- $this->assertStringContainsString('* @param Test|null $test1', $printed);
+ $this->assertEquals('?Some', $parameters['test1']['type']);
+ $this->assertStringContainsString('* @param Some|null $test1', $printed);
$this->assertTrue($parameters['test1']['optional']);
$this->assertArrayHasKey('str3', $parameters);
diff --git a/src/Prototype/tests/UtilsTest.php b/src/Prototype/tests/UtilsTest.php
index 13a80316b..1ac99a772 100644
--- a/src/Prototype/tests/UtilsTest.php
+++ b/src/Prototype/tests/UtilsTest.php
@@ -4,95 +4,72 @@
namespace Spiral\Tests\Prototype;
+use PHPUnit\Framework\Attributes\DataProvider;
use PHPUnit\Framework\TestCase;
use Spiral\Prototype\Utils;
class UtilsTest extends TestCase
{
- /**
- * @dataProvider trailingProvider
- *
- * @param string $name
- * @param int $sequence
- * @param string $expected
- */
+ #[DataProvider('trailingProvider')]
public function testTrimTrailingDigits(string $name, int $sequence, string $expected): void
{
$this->assertEquals($expected, Utils::trimTrailingDigits($name, $sequence));
}
- public function trailingProvider(): array
+ public static function trailingProvider(): \Traversable
{
- return [
- ['name7', 7, 'name',],
- ['name', 0, 'name',],
- ['name0', 0, 'name',],
- ['name1', 1, 'name'],
- ['name-1', 1, 'name-'],
- ['name-1', -1, 'name'],
- ];
+ yield ['name7', 7, 'name',];
+ yield ['name', 0, 'name',];
+ yield ['name0', 0, 'name',];
+ yield ['name1', 1, 'name'];
+ yield ['name-1', 1, 'name-'];
+ yield ['name-1', -1, 'name'];
}
- /**
- * @dataProvider injectValuesProvider
- *
- * @param array $array
- * @param int $index
- * @param array $child
- * @param array $expected
- */
+ #[DataProvider('injectValuesProvider')]
public function testInjectValues(array $array, int $index, array $child, array $expected): void
{
$this->assertEquals($expected, Utils::injectValues($array, $index, $child));
}
- public function injectValuesProvider(): array
+ public static function injectValuesProvider(): \Traversable
{
- return [
- [
- ['a', 'b', 'c', 'd', 'e'],
- 0,
- ['aa', 'bb'],
- ['aa', 'bb', 'a', 'b', 'c', 'd', 'e'],
- ],
- [
- ['a', 'b', 'c', 'd', 'e'],
- -2,
- ['aa', 'bb'],
- ['a', 'b', 'c', 'aa', 'bb', 'd', 'e'],
- ],
- [
- ['a', 'b', 'c', 'd', 'e'],
- 2,
- ['aa', 'bb'],
- ['a', 'b', 'aa', 'bb', 'c', 'd', 'e'],
- ],
- [
- ['a', 'b', 'c', 'd', 'e'],
- 5,
- ['aa', 'bb'],
- ['a', 'b', 'c', 'd', 'e', 'aa', 'bb'],
- ],
+ yield [
+ ['a', 'b', 'c', 'd', 'e'],
+ 0,
+ ['aa', 'bb'],
+ ['aa', 'bb', 'a', 'b', 'c', 'd', 'e'],
+ ];
+ yield [
+ ['a', 'b', 'c', 'd', 'e'],
+ -2,
+ ['aa', 'bb'],
+ ['a', 'b', 'c', 'aa', 'bb', 'd', 'e'],
+ ];
+ yield [
+ ['a', 'b', 'c', 'd', 'e'],
+ 2,
+ ['aa', 'bb'],
+ ['a', 'b', 'aa', 'bb', 'c', 'd', 'e'],
+ ];
+ yield [
+ ['a', 'b', 'c', 'd', 'e'],
+ 5,
+ ['aa', 'bb'],
+ ['a', 'b', 'c', 'd', 'e', 'aa', 'bb'],
];
}
- /**
- * @dataProvider shortNameProvider
- *
- * @param string $name
- * @param string $expected
- */
+ #[DataProvider('shortNameProvider')]
public function testShortName(string $name, string $expected): void
{
$this->assertEquals($expected, Utils::shortName($name));
}
- public function shortNameProvider(): array
+ public static function shortNameProvider(): \Traversable
{
- return [
- ['a\b\cdef', 'cdef'],
- ['abcdef', 'abcdef'],
- ['abcdef\\', ''],
- ];
+ yield ['a\b\cdef', 'cdef'];
+ yield ['abcdef', 'abcdef'];
+ yield ['abcdef\\', ''];
}
}
diff --git a/src/Queue/composer.json b/src/Queue/composer.json
index d65c54aaf..15a0d8ad1 100644
--- a/src/Queue/composer.json
+++ b/src/Queue/composer.json
@@ -51,7 +51,7 @@
},
"require-dev": {
"doctrine/annotations": "^1.12 || ^2.0",
- "phpunit/phpunit": "^9.5.20",
+ "phpunit/phpunit": "^10.1",
"mockery/mockery": "^1.5",
"spiral/boot": "^3.8",
"vimeo/psalm": "^5.9"
diff --git a/src/Queue/tests/Config/QueueConfigTest.php b/src/Queue/tests/Config/QueueConfigTest.php
index 4ad250755..5e03910e1 100644
--- a/src/Queue/tests/Config/QueueConfigTest.php
+++ b/src/Queue/tests/Config/QueueConfigTest.php
@@ -4,6 +4,7 @@
namespace Spiral\Tests\Queue\Config;
+use PHPUnit\Framework\Attributes\DataProvider;
use Spiral\Core\Container\Autowire;
use Spiral\Queue\Config\QueueConfig;
use Spiral\Queue\Exception\InvalidArgumentException;
@@ -61,7 +62,7 @@ public function testGetsDefaultDriver(): void
public function testGetsNonStringDefaultDriverShouldThrowAnException(): void
{
$this->expectException(InvalidArgumentException::class);
- $this->expectErrorMessage('Default queue connection config value must be a string');
+ $this->expectExceptionMessage('Default queue connection config value must be a string');
$config = new QueueConfig(['default' => ['foo']]);
@@ -176,7 +177,7 @@ public function testGetsConnection(): void
public function testGetsNonExistConnectionShouldThrowAnException(): void
{
$this->expectException(InvalidArgumentException::class);
- $this->expectErrorMessage('Queue connection with given name `foo` is not defined.');
+ $this->expectExceptionMessage('Queue connection with given name `foo` is not defined.');
$config = new QueueConfig();
$config->getConnection('foo');
@@ -185,7 +186,7 @@ public function testGetsNonExistConnectionShouldThrowAnException(): void
public function testGetsConnectionWithoutDriverShouldThrowAnException(): void
{
$this->expectException(InvalidArgumentException::class);
- $this->expectErrorMessage('Driver for queue connection `foo` is not defined.');
+ $this->expectExceptionMessage('Driver for queue connection `foo` is not defined.');
$config = new QueueConfig([
'connections' => [
@@ -199,7 +200,7 @@ public function testGetsConnectionWithoutDriverShouldThrowAnException(): void
public function testGetsConnectionWithWrongDriverValueTypeShouldThrowAnException(): void
{
$this->expectException(InvalidArgumentException::class);
- $this->expectErrorMessage('Driver for queue connection `foo` value must be a string');
+ $this->expectExceptionMessage('Driver for queue connection `foo` value must be a string');
$config = new QueueConfig([
'connections' => [
@@ -215,7 +216,7 @@ public function testGetsConnectionWithWrongDriverValueTypeShouldThrowAnException
public function testGetsConnectionWithWrongDriverAliasValueTypeShouldThrowAnException(): void
{
$this->expectException(InvalidArgumentException::class);
- $this->expectErrorMessage('Driver alias for queue connection `foo` value must be a string');
+ $this->expectExceptionMessage('Driver alias for queue connection `foo` value must be a string');
$config = new QueueConfig([
'connections' => [
@@ -267,7 +268,7 @@ public function testGetNotExistsRegistrySerializers(): void
$this->assertSame([], $config->getRegistrySerializers());
}
- /** @dataProvider defaultSerializerDataProvider */
+ #[DataProvider('defaultSerializerDataProvider')]
public function testGetDefaultSerializer(array $config, mixed $expected): void
{
$config = new QueueConfig($config);
@@ -275,7 +276,7 @@ public function testGetDefaultSerializer(array $config, mixed $expected): void
$this->assertEquals($expected, $config->getDefaultSerializer());
}
- public function defaultSerializerDataProvider(): \Generator
+ public static function defaultSerializerDataProvider(): \Generator
{
yield [[], null];
yield [['defaultSerializer' => null], null];
diff --git a/src/Queue/tests/ContainerRegistryT.php b/src/Queue/tests/ContainerRegistryT.php
index 3de0892ae..875863748 100644
--- a/src/Queue/tests/ContainerRegistryT.php
+++ b/src/Queue/tests/ContainerRegistryT.php
@@ -38,7 +38,7 @@ public function testGetsHandlerByJobType(): void
public function testGetsHandlerWithWrongInterface(): void
{
$this->expectException(JobException::class);
- $this->expectErrorMessage('Unable to resolve job handler for `mail.job`');
+ $this->expectExceptionMessage('Unable to resolve job handler for `mail.job`');
$this->container->shouldReceive('get')
->with('Mail\Job')
@@ -50,7 +50,7 @@ public function testGetsHandlerWithWrongInterface(): void
public function testGetsNotExistsHandler(): void
{
$this->expectException(JobException::class);
- $this->expectErrorMessage("Undefined class or binding 'Mail\Job'");
+ $this->expectExceptionMessage("Undefined class or binding 'Mail\Job'");
$this->container->shouldReceive('get')
->with('Mail\Job')
diff --git a/src/Queue/tests/Driver/NullDriverTest.php b/src/Queue/tests/Driver/NullDriverTest.php
index 06b12078c..a740fc3de 100644
--- a/src/Queue/tests/Driver/NullDriverTest.php
+++ b/src/Queue/tests/Driver/NullDriverTest.php
@@ -4,6 +4,7 @@
namespace Spiral\Tests\Queue\Driver;
+use PHPUnit\Framework\Attributes\DataProvider;
use Spiral\Queue\Driver\NullDriver;
use Spiral\Tests\Queue\TestCase;
@@ -16,16 +17,14 @@ protected function setUp(): void
$this->queue = new NullDriver();
}
- /**
- * @dataProvider PayloadDataProvider
- */
+ #[DataProvider('payloadDataProvider')]
public function testJobShouldBePushed(mixed $payload): void
{
$id = $this->queue->push('foo', $payload);
$this->assertNotNull($id);
}
- public function PayloadDataProvider(): \Traversable
+ public static function payloadDataProvider(): \Traversable
{
yield [['baz' => 'baf']];
yield [new \stdClass()];
diff --git a/src/Queue/tests/Driver/SyncDriverTest.php b/src/Queue/tests/Driver/SyncDriverTest.php
index 7ec37e8e9..d3d1f3962 100644
--- a/src/Queue/tests/Driver/SyncDriverTest.php
+++ b/src/Queue/tests/Driver/SyncDriverTest.php
@@ -5,6 +5,7 @@
namespace Spiral\Tests\Queue\Driver;
use Mockery as m;
+use PHPUnit\Framework\Attributes\DataProvider;
use Ramsey\Uuid\Uuid;
use Ramsey\Uuid\UuidFactory;
use Ramsey\Uuid\UuidFactoryInterface;
@@ -40,9 +41,7 @@ protected function setUp(): void
);
}
- /**
- * @dataProvider PayloadDataProvider
- */
+ #[DataProvider('payloadDataProvider')]
public function testJobShouldBePushed(mixed $payload): void
{
$this->factory->shouldReceive('uuid4')
@@ -63,7 +62,7 @@ public function testJobShouldBePushed(mixed $payload): void
$this->assertSame($uuid->toString(), $id);
}
- public function PayloadDataProvider(): \Traversable
+ public static function payloadDataProvider(): \Traversable
{
yield [['baz' => 'baf']];
yield [new \stdClass()];
diff --git a/src/Queue/tests/Failed/LogFailedJobHandlerTest.php b/src/Queue/tests/Failed/LogFailedJobHandlerTest.php
index ba9d55fed..32a997017 100644
--- a/src/Queue/tests/Failed/LogFailedJobHandlerTest.php
+++ b/src/Queue/tests/Failed/LogFailedJobHandlerTest.php
@@ -5,15 +5,14 @@
namespace Spiral\Tests\Queue\Failed;
use Mockery as m;
+use PHPUnit\Framework\Attributes\DataProvider;
use Spiral\Exceptions\ExceptionReporterInterface;
use Spiral\Queue\Failed\LogFailedJobHandler;
use Spiral\Tests\Queue\TestCase;
final class LogFailedJobHandlerTest extends TestCase
{
- /**
- * @dataProvider PayloadDataProvider
- */
+ #[DataProvider('payloadDataProvider')]
public function testHandle(mixed $payload): void
{
$handler = new LogFailedJobHandler(
@@ -27,7 +26,7 @@ public function testHandle(mixed $payload): void
$handler->handle('foo', 'bar', 'baz', $payload, $e);
}
- public function PayloadDataProvider(): \Traversable
+ public static function payloadDataProvider(): \Traversable
{
yield [['baz' => 'baf']];
yield [new \stdClass()];
diff --git a/src/Queue/tests/Interceptor/Consume/CoreTest.php b/src/Queue/tests/Interceptor/Consume/CoreTest.php
index 33486c604..ead0403cd 100644
--- a/src/Queue/tests/Interceptor/Consume/CoreTest.php
+++ b/src/Queue/tests/Interceptor/Consume/CoreTest.php
@@ -5,6 +5,7 @@
namespace Spiral\Tests\Queue\Interceptor\Consume;
use Mockery as m;
+use PHPUnit\Framework\Attributes\DataProvider;
use Psr\EventDispatcher\EventDispatcherInterface;
use Spiral\Queue\Event\JobProcessed;
use Spiral\Queue\Event\JobProcessing;
@@ -15,9 +16,7 @@
final class CoreTest extends TestCase
{
- /**
- * @dataProvider PayloadDataProvider
- */
+ #[DataProvider('payloadDataProvider')]
public function testCallAction(mixed $payload): void
{
$core = new Core(
@@ -44,9 +43,7 @@ public function testCallAction(mixed $payload): void
);
}
- /**
- * @dataProvider PayloadDataProvider
- */
+ #[DataProvider('payloadDataProvider')]
public function testEventsShouldBeDispatched(mixed $payload): void
{
$dispatcher = $this->createMock(EventDispatcherInterface::class);
@@ -79,7 +76,7 @@ public function testEventsShouldBeDispatched(mixed $payload): void
]);
}
- public function PayloadDataProvider(): \Traversable
+ public static function payloadDataProvider(): \Traversable
{
yield [['baz' => 'baf']];
yield [new \stdClass()];
diff --git a/src/Queue/tests/Interceptor/Consume/ErrorHandlerInterceptorTest.php b/src/Queue/tests/Interceptor/Consume/ErrorHandlerInterceptorTest.php
index c60275861..ada517991 100644
--- a/src/Queue/tests/Interceptor/Consume/ErrorHandlerInterceptorTest.php
+++ b/src/Queue/tests/Interceptor/Consume/ErrorHandlerInterceptorTest.php
@@ -5,6 +5,7 @@
namespace Spiral\Tests\Queue\Interceptor\Consume;
use Mockery as m;
+use PHPUnit\Framework\Attributes\DataProvider;
use Spiral\Core\CoreInterface;
use Spiral\Queue\Failed\FailedJobHandlerInterface;
use Spiral\Queue\Interceptor\Consume\ErrorHandlerInterceptor;
@@ -12,13 +13,11 @@
final class ErrorHandlerInterceptorTest extends TestCase
{
- /**
- * @dataProvider PayloadDataProvider
- */
+ #[DataProvider('payloadDataProvider')]
public function testProcessError(mixed $payload): void
{
$this->expectException(\Exception::class);
- $this->expectErrorMessage('Something went wrong');
+ $this->expectExceptionMessage('Something went wrong');
$interceptor = new ErrorHandlerInterceptor(
$handler = m::mock(FailedJobHandlerInterface::class)
@@ -60,7 +59,7 @@ public function testHandlerShouldBeHandledWithoutError(): void
$interceptor->process('foo', 'bar', $parameters, $core);
}
- public function PayloadDataProvider(): \Traversable
+ public static function payloadDataProvider(): \Traversable
{
yield [['baz' => 'baf']];
yield [new \stdClass()];
diff --git a/src/Queue/tests/Interceptor/Consume/HandlerTest.php b/src/Queue/tests/Interceptor/Consume/HandlerTest.php
index f824e4208..6c760e0e2 100644
--- a/src/Queue/tests/Interceptor/Consume/HandlerTest.php
+++ b/src/Queue/tests/Interceptor/Consume/HandlerTest.php
@@ -5,6 +5,7 @@
namespace Spiral\Tests\Queue\Interceptor;
use Mockery as m;
+use PHPUnit\Framework\Attributes\DataProvider;
use Spiral\Core\CoreInterface;
use Spiral\Queue\Interceptor\Consume\Handler;
use Spiral\Telemetry\NullTracer;
@@ -13,9 +14,7 @@
final class HandlerTest extends TestCase
{
- /**
- * @dataProvider PayloadDataProvider
- */
+ #[DataProvider('payloadDataProvider')]
public function testHandle(mixed $payload): void
{
$tracerFactory = m::mock(TracerFactoryInterface::class);
@@ -43,7 +42,7 @@ public function testHandle(mixed $payload): void
$handler->handle('foo', 'sync', 'default', 'job-id', $payload, ['some' => 'data']);
}
- public function PayloadDataProvider(): \Traversable
+ public static function payloadDataProvider(): \Traversable
{
yield [['baz' => 'baf']];
yield [new \stdClass()];
diff --git a/src/Queue/tests/Interceptor/Push/CoreTest.php b/src/Queue/tests/Interceptor/Push/CoreTest.php
index 06e34beaf..ebe9067b4 100644
--- a/src/Queue/tests/Interceptor/Push/CoreTest.php
+++ b/src/Queue/tests/Interceptor/Push/CoreTest.php
@@ -5,6 +5,7 @@
namespace Spiral\Tests\Queue\Interceptor\Push;
use Mockery as m;
+use PHPUnit\Framework\Attributes\DataProvider;
use Spiral\Core\Container;
use Spiral\Core\ContainerScope;
use Spiral\Queue\Interceptor\Push\Core;
@@ -16,9 +17,7 @@
final class CoreTest extends TestCase
{
- /**
- * @dataProvider PayloadDataProvider
- */
+ #[DataProvider('payloadDataProvider')]
public function testCallActionWithNullOptions(mixed $payload): void
{
$core = new Core(
@@ -42,9 +41,7 @@ public function testCallActionWithNullOptions(mixed $payload): void
]);
}
- /**
- * @dataProvider PayloadDataProvider
- */
+ #[DataProvider('payloadDataProvider')]
public function testCallActionWithOptions(mixed $payload): void
{
$core = new Core(
@@ -122,7 +119,7 @@ public function testCallWithTracerContextWitoutOptionsWithHeadersSupport(): void
]);
}
- public function PayloadDataProvider(): \Traversable
+ public static function payloadDataProvider(): \Traversable
{
yield [['baz' => 'baf']];
yield [new \stdClass()];
diff --git a/src/Queue/tests/Job/CallableJobTest.php b/src/Queue/tests/Job/CallableJobTest.php
index 1851e8fc2..9a168b075 100644
--- a/src/Queue/tests/Job/CallableJobTest.php
+++ b/src/Queue/tests/Job/CallableJobTest.php
@@ -15,7 +15,7 @@ final class CallableJobTest extends TestCase
public function testPayloadCallbackKeyIsRequired(): void
{
$this->expectException(InvalidArgumentException::class);
- $this->expectErrorMessage('Payload `callback` key is required.');
+ $this->expectExceptionMessage('Payload `callback` key is required.');
$job = new CallableJob(new Container());
$job->handle('foo', 'foo-id', []);
@@ -24,7 +24,7 @@ public function testPayloadCallbackKeyIsRequired(): void
public function testPayloadCallbackValueShouldBeClosure(): void
{
$this->expectException(InvalidArgumentException::class);
- $this->expectErrorMessage('Payload `callback` key value type should be a closure.');
+ $this->expectExceptionMessage('Payload `callback` key value type should be a closure.');
$job = new CallableJob(new Container());
$job->handle('foo', 'foo-id', ['callback' => 'test']);
diff --git a/src/Queue/tests/Job/ObjectJobTest.php b/src/Queue/tests/Job/ObjectJobTest.php
index c079f0ebc..956d092a5 100644
--- a/src/Queue/tests/Job/ObjectJobTest.php
+++ b/src/Queue/tests/Job/ObjectJobTest.php
@@ -24,7 +24,7 @@ protected function setUp(): void
public function testPayloadObjectKeyIsRequired(): void
{
$this->expectException(InvalidArgumentException::class);
- $this->expectErrorMessage('Payload `object` key is required.');
+ $this->expectExceptionMessage('Payload `object` key is required.');
$job = new ObjectJob($this->container);
$job->handle('foo', 'foo-id', []);
@@ -33,7 +33,7 @@ public function testPayloadObjectKeyIsRequired(): void
public function testPayloadObjectValueShouldBeObject(): void
{
$this->expectException(InvalidArgumentException::class);
- $this->expectErrorMessage('Payload `object` key value type should be an object.');
+ $this->expectExceptionMessage('Payload `object` key value type should be an object.');
$job = new ObjectJob($this->container);
$job->handle('foo', 'foo-id', ['object' => 'test']);
diff --git a/src/Queue/tests/QueueRegistryTest.php b/src/Queue/tests/QueueRegistryTest.php
index a86ba1c1b..539d90d7f 100644
--- a/src/Queue/tests/QueueRegistryTest.php
+++ b/src/Queue/tests/QueueRegistryTest.php
@@ -5,6 +5,7 @@
namespace Spiral\Tests\Queue;
use Mockery as m;
+use PHPUnit\Framework\Attributes\DataProvider;
use Spiral\Core\Container;
use Spiral\Core\Container\Autowire;
use Spiral\Queue\Config\QueueConfig;
@@ -77,7 +78,7 @@ public function testDefaultSerializerIsNull(): void
$this->assertInstanceOf(JsonSerializer::class, $this->registry->getSerializer());
}
- /** @dataProvider serializersDataProvider */
+ #[DataProvider('serializersDataProvider')]
public function testDefaultSerializer(
SerializerRegistry $registry,
string|SerializerInterface|Autowire $serializer
@@ -88,7 +89,7 @@ public function testDefaultSerializer(
$this->assertInstanceOf(JsonSerializer::class, $this->registry->getSerializer());
}
- /** @dataProvider serializersDataProvider */
+ #[DataProvider('serializersDataProvider')]
public function testSerializer(SerializerRegistry $registry, string|SerializerInterface|Autowire $serializer): void
{
$this->mockContainer->bind(SerializerRegistryInterface::class, $registry);
@@ -101,7 +102,7 @@ public function testSerializer(SerializerRegistry $registry, string|SerializerIn
$this->assertInstanceOf(SerializerInterface::class, $this->registry->getSerializer('foo'));
}
- public function serializersDataProvider(): \Traversable
+ public static function serializersDataProvider(): \Traversable
{
// serializer name
yield [new SerializerRegistry(['some' => new JsonSerializer()]), 'some'];
diff --git a/src/Queue/tests/QueueTest.php b/src/Queue/tests/QueueTest.php
index 187bc7e59..9f679a7ca 100644
--- a/src/Queue/tests/QueueTest.php
+++ b/src/Queue/tests/QueueTest.php
@@ -5,15 +5,14 @@
namespace Spiral\Tests\Queue;
use Mockery as m;
+use PHPUnit\Framework\Attributes\DataProvider;
use Spiral\Core\CoreInterface;
use Spiral\Queue\Options;
use Spiral\Queue\Queue;
final class QueueTest extends TestCase
{
- /**
- * @dataProvider pushDataProvider
- */
+ #[DataProvider('pushDataProvider')]
public function testPush(mixed $payload, mixed $options): void
{
$queue = new Queue(
@@ -32,7 +31,7 @@ public function testPush(mixed $payload, mixed $options): void
$this->assertSame('task-id', $id);
}
- public function pushDataProvider(): \Traversable
+ public static function pushDataProvider(): \Traversable
{
yield ['some string', new Options()];
yield [123, new Options()];
diff --git a/src/Queue/tests/QueueableDetectorTest.php b/src/Queue/tests/QueueableDetectorTest.php
index cbf9b4886..6e6ebe3cd 100644
--- a/src/Queue/tests/QueueableDetectorTest.php
+++ b/src/Queue/tests/QueueableDetectorTest.php
@@ -4,6 +4,7 @@
namespace Spiral\Tests\Queue;
+use PHPUnit\Framework\Attributes\DataProvider;
use Spiral\Attributes\Factory;
use Spiral\Queue\QueueableDetector;
use Spiral\Tests\Queue\Attribute\Stub\NotQueueable;
@@ -16,9 +17,7 @@
final class QueueableDetectorTest extends TestCase
{
- /**
- * @dataProvider queueableProvider
- */
+ #[DataProvider('queueableProvider')]
public function testQueueable($object, bool $queueable, ?string $queue): void
{
$detector = new QueueableDetector((new Factory())->create());
@@ -27,7 +26,7 @@ public function testQueueable($object, bool $queueable, ?string $queue): void
$this->assertSame($queue, $detector->getQueue($object));
}
- public function queueableProvider(): \Traversable
+ public static function queueableProvider(): \Traversable
{
yield [Queueable::class, true, null];
yield [QueueableWithQueue::class, true, 'test'];
diff --git a/src/Reactor/composer.json b/src/Reactor/composer.json
index 7503eb039..352abc816 100644
--- a/src/Reactor/composer.json
+++ b/src/Reactor/composer.json
@@ -33,7 +33,7 @@
"nette/php-generator": "^4.0.1"
},
"require-dev": {
- "phpunit/phpunit": "^9.5.20",
+ "phpunit/phpunit": "^10.1",
"mockery/mockery": "^1.5",
"psr/container": "^1.1|^2.0",
"vimeo/psalm": "^5.9"
diff --git a/src/Reactor/tests/BaseWithElementsTest.php b/src/Reactor/tests/BaseWithElementsTestCase.php
similarity index 87%
rename from src/Reactor/tests/BaseWithElementsTest.php
rename to src/Reactor/tests/BaseWithElementsTestCase.php
index 96e9139d7..5c10d1202 100644
--- a/src/Reactor/tests/BaseWithElementsTest.php
+++ b/src/Reactor/tests/BaseWithElementsTestCase.php
@@ -11,11 +11,11 @@
use Spiral\Reactor\Aggregator\Interfaces;
use Spiral\Reactor\Aggregator\Traits;
-abstract class BaseWithElementsTest extends TestCase
+abstract class BaseWithElementsTestCase extends TestCase
{
- public function classesDataProvider(): \Traversable
+ public static function classesDataProvider(): \Traversable
{
- $testedClass = $this->getTestedClass();
+ $testedClass = static::getTestedClass();
$withoutClasses = new $testedClass('a');
$withoutClasses->addInterface('b');
@@ -42,9 +42,9 @@ public function classesDataProvider(): \Traversable
yield [$withOtherElements, new Classes(['d' => $d])];
}
- public function interfacesDataProvider(): \Traversable
+ public static function interfacesDataProvider(): \Traversable
{
- $testedClass = $this->getTestedClass();
+ $testedClass = static::getTestedClass();
$withoutInterfaces = new $testedClass('a');
$withoutInterfaces->addClass('b');
@@ -71,9 +71,9 @@ public function interfacesDataProvider(): \Traversable
yield [$withOtherElements, new Interfaces(['d' => $d])];
}
- public function traitsDataProvider(): \Traversable
+ public static function traitsDataProvider(): \Traversable
{
- $testedClass = $this->getTestedClass();
+ $testedClass = static::getTestedClass();
$withoutTraits = new $testedClass('a');
$withoutTraits->addClass('b');
@@ -100,9 +100,9 @@ public function traitsDataProvider(): \Traversable
yield [$withOtherElements, new Traits(['d' => $d])];
}
- public function enumsDataProvider(): \Traversable
+ public static function enumsDataProvider(): \Traversable
{
- $testedClass = $this->getTestedClass();
+ $testedClass = static::getTestedClass();
$withoutEnums = new $testedClass('a');
$withoutEnums->addClass('b');
@@ -129,9 +129,9 @@ public function enumsDataProvider(): \Traversable
yield [$withOtherElements, new Enums(['d' => $d])];
}
- public function elementsDataProvider(): \Traversable
+ public static function elementsDataProvider(): \Traversable
{
- $testedClass = $this->getTestedClass();
+ $testedClass = static::getTestedClass();
$class = new $testedClass('a');
$a = $class->addClass('a');
@@ -164,5 +164,5 @@ public function elementsDataProvider(): \Traversable
])];
}
- abstract protected function getTestedClass(): string;
+ abstract protected static function getTestedClass(): string;
}
diff --git a/src/Reactor/tests/FileDeclarationTest.php b/src/Reactor/tests/FileDeclarationTest.php
index 1f2f0d1f5..644b3f868 100644
--- a/src/Reactor/tests/FileDeclarationTest.php
+++ b/src/Reactor/tests/FileDeclarationTest.php
@@ -5,6 +5,7 @@
namespace Spiral\Tests\Reactor;
use Nette\PhpGenerator\PhpFile;
+use PHPUnit\Framework\Attributes\DataProvider;
use Spiral\Reactor\Aggregator\Classes;
use Spiral\Reactor\Aggregator\Elements;
use Spiral\Reactor\Aggregator\Enums;
@@ -13,7 +14,7 @@
use Spiral\Reactor\ClassDeclaration;
use Spiral\Reactor\FileDeclaration;
-final class FileDeclarationTest extends BaseWithElementsTest
+final class FileDeclarationTest extends BaseWithElementsTestCase
{
public function testFromCode(): void
{
@@ -158,47 +159,37 @@ public function testGetElement(): void
$this->assertInstanceOf(PhpFile::class, $element);
}
- /**
- * @dataProvider classesDataProvider
- */
+ #[DataProvider('classesDataProvider')]
public function testGetClasses(FileDeclaration $file, Classes $expected): void
{
$this->assertEquals($file->getClasses(), $expected);
}
- /**
- * @dataProvider interfacesDataProvider
- */
+ #[DataProvider('interfacesDataProvider')]
public function testGetInterfaces(FileDeclaration $file, Interfaces $expected): void
{
$this->assertEquals($file->getInterfaces(), $expected);
}
- /**
- * @dataProvider traitsDataProvider
- */
+ #[DataProvider('traitsDataProvider')]
public function testGetTraits(FileDeclaration $file, Traits $expected): void
{
$this->assertEquals($file->getTraits(), $expected);
}
- /**
- * @dataProvider enumsDataProvider
- */
+ #[DataProvider('enumsDataProvider')]
public function testGetEnums(FileDeclaration $file, Enums $expected): void
{
$this->assertEquals($file->getEnums(), $expected);
}
- /**
- * @dataProvider elementsDataProvider
- */
+ #[DataProvider('elementsDataProvider')]
public function testGetElements(FileDeclaration $file, Elements $expected): void
{
$this->assertEquals($file->getElements(), $expected);
}
- protected function getTestedClass(): string
+ protected static function getTestedClass(): string
{
return FileDeclaration::class;
}
diff --git a/src/Reactor/tests/Partial/PhpNamespaceTest.php b/src/Reactor/tests/Partial/PhpNamespaceTest.php
index 2b06a63a7..77193191a 100644
--- a/src/Reactor/tests/Partial/PhpNamespaceTest.php
+++ b/src/Reactor/tests/Partial/PhpNamespaceTest.php
@@ -5,6 +5,7 @@
namespace Spiral\Tests\Reactor\Partial;
use Nette\PhpGenerator\PhpNamespace as NettePhpNamespace;
+use PHPUnit\Framework\Attributes\DataProvider;
use Spiral\Reactor\Aggregator\Classes;
use Spiral\Reactor\Aggregator\Elements;
use Spiral\Reactor\Aggregator\Enums;
@@ -12,9 +13,9 @@
use Spiral\Reactor\Aggregator\Traits;
use Spiral\Reactor\FileDeclaration;
use Spiral\Reactor\Partial\PhpNamespace;
-use Spiral\Tests\Reactor\BaseWithElementsTest;
+use Spiral\Tests\Reactor\BaseWithElementsTestCase;
-final class PhpNamespaceTest extends BaseWithElementsTest
+final class PhpNamespaceTest extends BaseWithElementsTestCase
{
public function testGetName(): void
{
@@ -194,47 +195,37 @@ public function testGetElement(): void
$this->assertSame('Foo\\Bar', $element->getName());
}
- /**
- * @dataProvider classesDataProvider
- */
+ #[DataProvider('classesDataProvider')]
public function testGetClasses(PhpNamespace $namespace, Classes $expected): void
{
$this->assertEquals($namespace->getClasses(), $expected);
}
- /**
- * @dataProvider interfacesDataProvider
- */
+ #[DataProvider('interfacesDataProvider')]
public function testGetInterfaces(PhpNamespace $namespace, Interfaces $expected): void
{
$this->assertEquals($namespace->getInterfaces(), $expected);
}
- /**
- * @dataProvider traitsDataProvider
- */
+ #[DataProvider('traitsDataProvider')]
public function testGetTraits(PhpNamespace $namespace, Traits $expected): void
{
$this->assertEquals($namespace->getTraits(), $expected);
}
- /**
- * @dataProvider enumsDataProvider
- */
+ #[DataProvider('enumsDataProvider')]
public function testGetEnums(PhpNamespace $namespace, Enums $expected): void
{
$this->assertEquals($namespace->getEnums(), $expected);
}
- /**
- * @dataProvider elementsDataProvider
- */
+ #[DataProvider('elementsDataProvider')]
public function testGetElements(PhpNamespace $namespace, Elements $expected): void
{
$this->assertEquals($namespace->getElements(), $expected);
}
- protected function getTestedClass(): string
+ protected static function getTestedClass(): string
{
return PhpNamespace::class;
}
diff --git a/src/Router/composer.json b/src/Router/composer.json
index 52cfaff0f..d1dd2370c 100644
--- a/src/Router/composer.json
+++ b/src/Router/composer.json
@@ -38,7 +38,7 @@
"psr/event-dispatcher": "^1.0"
},
"require-dev": {
- "phpunit/phpunit": "^9.5.20",
+ "phpunit/phpunit": "^10.1",
"mockery/mockery": "^1.5",
"nyholm/psr7": "^1.5",
"vimeo/psalm": "^5.9"
diff --git a/src/Router/tests/BaseTest.php b/src/Router/tests/BaseTestCase.php
similarity index 96%
rename from src/Router/tests/BaseTest.php
rename to src/Router/tests/BaseTestCase.php
index ce036fb97..2c8ced74e 100644
--- a/src/Router/tests/BaseTest.php
+++ b/src/Router/tests/BaseTestCase.php
@@ -29,7 +29,7 @@
use Spiral\Tests\Router\Stub\TestLoader;
use Spiral\Tests\Router\Stub\TestMiddleware;
-abstract class BaseTest extends TestCase
+abstract class BaseTestCase extends TestCase
{
protected Container $container;
protected Router $router;
@@ -64,7 +64,7 @@ protected function getProperty(object $object, string $property): mixed
return $r->getProperty($property)->getValue($object);
}
- protected function middlewaresDataProvider(): \Traversable
+ public static function middlewaresDataProvider(): \Traversable
{
yield [TestMiddleware::class];
yield [new TestMiddleware()];
diff --git a/src/Router/tests/CallableTest.php b/src/Router/tests/CallableTest.php
index 5087c3a39..d7cb78991 100644
--- a/src/Router/tests/CallableTest.php
+++ b/src/Router/tests/CallableTest.php
@@ -9,7 +9,7 @@
use Nyholm\Psr7\ServerRequest;
use Nyholm\Psr7\Uri;
-class CallableTest extends BaseTest
+class CallableTest extends BaseTestCase
{
public function testFunctionRoute(): void
{
diff --git a/src/Router/tests/ControllerTest.php b/src/Router/tests/ControllerTest.php
index 57210980b..c2f7590ad 100644
--- a/src/Router/tests/ControllerTest.php
+++ b/src/Router/tests/ControllerTest.php
@@ -12,7 +12,7 @@
use Nyholm\Psr7\ServerRequest;
use Nyholm\Psr7\Uri;
-class ControllerTest extends BaseTest
+class ControllerTest extends BaseTestCase
{
public function testRouteException(): void
{
diff --git a/src/Router/tests/CoreTest.php b/src/Router/tests/CoreTest.php
index e9c13a982..fb8977cc7 100644
--- a/src/Router/tests/CoreTest.php
+++ b/src/Router/tests/CoreTest.php
@@ -16,7 +16,7 @@
use Spiral\Tests\Router\Fixtures\TestController;
use Nyholm\Psr7\ServerRequest;
-class CoreTest extends BaseTest
+class CoreTest extends BaseTestCase
{
public function testMissingBinding(): void
{
diff --git a/src/Router/tests/GroupTest.php b/src/Router/tests/GroupTest.php
index fbc77b7da..bfe99e9fa 100644
--- a/src/Router/tests/GroupTest.php
+++ b/src/Router/tests/GroupTest.php
@@ -13,7 +13,7 @@
use Nyholm\Psr7\ServerRequest;
use Nyholm\Psr7\Uri;
-class GroupTest extends BaseTest
+class GroupTest extends BaseTestCase
{
public function testRouteException(): void
{
diff --git a/src/Router/tests/HostsTest.php b/src/Router/tests/HostsTest.php
index a0faa8a93..54e730529 100644
--- a/src/Router/tests/HostsTest.php
+++ b/src/Router/tests/HostsTest.php
@@ -10,7 +10,7 @@
use Spiral\Tests\Router\Fixtures\TestController;
use Nyholm\Psr7\ServerRequest;
-class HostsTest extends BaseTest
+class HostsTest extends BaseTestCase
{
public function testRouteException(): void
{
diff --git a/src/Router/tests/Loader/Configurator/RouteConfiguratorTest.php b/src/Router/tests/Loader/Configurator/RouteConfiguratorTest.php
index 87005f9e4..58b46c6d6 100644
--- a/src/Router/tests/Loader/Configurator/RouteConfiguratorTest.php
+++ b/src/Router/tests/Loader/Configurator/RouteConfiguratorTest.php
@@ -18,9 +18,9 @@
use Spiral\Router\Target\Controller;
use Spiral\Router\Target\Group;
use Spiral\Router\Target\Namespaced;
-use Spiral\Tests\Router\BaseTest;
+use Spiral\Tests\Router\BaseTestCase;
-final class RouteConfiguratorTest extends BaseTest
+final class RouteConfiguratorTest extends BaseTestCase
{
public function testDestructException(): void
{
diff --git a/src/Router/tests/Loader/Configurator/RoutingConfiguratorTest.php b/src/Router/tests/Loader/Configurator/RoutingConfiguratorTest.php
index 4dbaa3023..3dc094f91 100644
--- a/src/Router/tests/Loader/Configurator/RoutingConfiguratorTest.php
+++ b/src/Router/tests/Loader/Configurator/RoutingConfiguratorTest.php
@@ -7,9 +7,9 @@
use Spiral\Router\Loader\Configurator\RouteConfigurator;
use Spiral\Router\Loader\Configurator\RoutingConfigurator;
use Spiral\Router\RouteCollection;
-use Spiral\Tests\Router\BaseTest;
+use Spiral\Tests\Router\BaseTestCase;
-final class RoutingConfiguratorTest extends BaseTest
+final class RoutingConfiguratorTest extends BaseTestCase
{
public function testImportWithoutConcreteLoader(): void
{
diff --git a/src/Router/tests/MiddlewareTest.php b/src/Router/tests/MiddlewareTest.php
index c974a1717..48b64599d 100644
--- a/src/Router/tests/MiddlewareTest.php
+++ b/src/Router/tests/MiddlewareTest.php
@@ -13,7 +13,7 @@
use Nyholm\Psr7\ServerRequest;
use Nyholm\Psr7\Uri;
-class MiddlewareTest extends BaseTest
+class MiddlewareTest extends BaseTestCase
{
public function testRoute(): void
{
diff --git a/src/Router/tests/MultipleActionsTest.php b/src/Router/tests/MultipleActionsTest.php
index cb12cd1f6..cc3f32498 100644
--- a/src/Router/tests/MultipleActionsTest.php
+++ b/src/Router/tests/MultipleActionsTest.php
@@ -11,7 +11,7 @@
use Nyholm\Psr7\ServerRequest;
use Nyholm\Psr7\Uri;
-class MultipleActionsTest extends BaseTest
+class MultipleActionsTest extends BaseTestCase
{
public function testRouteException(): void
{
diff --git a/src/Router/tests/NamespacedTest.php b/src/Router/tests/NamespacedTest.php
index e5bc849fc..9583891f2 100644
--- a/src/Router/tests/NamespacedTest.php
+++ b/src/Router/tests/NamespacedTest.php
@@ -11,7 +11,7 @@
use Nyholm\Psr7\ServerRequest;
use Nyholm\Psr7\Uri;
-class NamespacedTest extends BaseTest
+class NamespacedTest extends BaseTestCase
{
public function testRouteException(): void
{
diff --git a/src/Router/tests/PipelineFactoryTest.php b/src/Router/tests/PipelineFactoryTest.php
index c3452b269..a8586a8d5 100644
--- a/src/Router/tests/PipelineFactoryTest.php
+++ b/src/Router/tests/PipelineFactoryTest.php
@@ -5,6 +5,7 @@
namespace Spiral\Tests\Router;
use Mockery as m;
+use PHPUnit\Framework\Attributes\DataProvider;
use Psr\Container\ContainerInterface;
use Psr\Http\Message\ResponseInterface;
use Psr\Http\Message\ServerRequestInterface;
@@ -102,9 +103,7 @@ public function testCreates(): void
->handle(m::mock(ServerRequestInterface::class));
}
- /**
- * @dataProvider invalidTypeDataProvider
- */
+ #[DataProvider('invalidTypeDataProvider')]
public function testInvalidTypeShouldThrowAnException(mixed $value, string $type): void
{
$this->factory
@@ -114,11 +113,11 @@ public function testInvalidTypeShouldThrowAnException(mixed $value, string $type
->andReturn(new Pipeline(m::mock(ScopeInterface::class)));
$this->expectException(RouteException::class);
- $this->expectErrorMessage(\sprintf('Invalid middleware `%s`', $type));
+ $this->expectExceptionMessage(\sprintf('Invalid middleware `%s`', $type));
$this->pipeline->createWithMiddleware([$value]);
}
- public function invalidTypeDataProvider(): \Generator
+ public static function invalidTypeDataProvider(): \Generator
{
yield 'true' => [true, 'bool'];
yield 'false' => [false, 'bool'];
diff --git a/src/Router/tests/RegistryTest.php b/src/Router/tests/RegistryTest.php
index cb93778e6..e6ebb8115 100644
--- a/src/Router/tests/RegistryTest.php
+++ b/src/Router/tests/RegistryTest.php
@@ -10,7 +10,7 @@
use Spiral\Router\RouterInterface;
use Spiral\Router\UriHandler;
-final class RegistryTest extends BaseTest
+final class RegistryTest extends BaseTestCase
{
public function testSameGroup(): void
{
diff --git a/src/Router/tests/RouteGroupTest.php b/src/Router/tests/RouteGroupTest.php
index b9683d61f..456709843 100644
--- a/src/Router/tests/RouteGroupTest.php
+++ b/src/Router/tests/RouteGroupTest.php
@@ -5,6 +5,7 @@
namespace Spiral\Tests\Router;
use Nyholm\Psr7\Factory\Psr17Factory;
+use PHPUnit\Framework\Attributes\DataProvider;
use Psr\Http\Message\UriFactoryInterface;
use Spiral\Core\Container;
use Spiral\Router\Loader\LoaderInterface;
@@ -16,7 +17,7 @@
use Spiral\Tests\Router\Stub\RoutesTestCore;
use Spiral\Tests\Router\Stub\TestMiddleware;
-final class RouteGroupTest extends BaseTest
+final class RouteGroupTest extends BaseTestCase
{
protected function setUp(): void
{
@@ -74,7 +75,7 @@ public function testGroupHasRoute(): void
$this->assertFalse($group->hasRoute('bar'));
}
- /** @dataProvider middlewaresDataProvider */
+ #[DataProvider('middlewaresDataProvider')]
public function testMiddleware(mixed $middleware): void
{
$group = new RouteGroup();
diff --git a/src/Router/tests/RouteTest.php b/src/Router/tests/RouteTest.php
index 0d7539977..fe8e8ebd2 100644
--- a/src/Router/tests/RouteTest.php
+++ b/src/Router/tests/RouteTest.php
@@ -4,6 +4,7 @@
namespace Spiral\Tests\Router;
+use PHPUnit\Framework\Attributes\DataProvider;
use Spiral\Router\Exception\RouteException;
use Spiral\Router\Route;
use Spiral\Tests\Router\Diactoros\UriFactory;
@@ -11,7 +12,7 @@
use Nyholm\Psr7\ServerRequest;
use Spiral\Tests\Router\Stub\TestMiddleware;
-class RouteTest extends BaseTest
+class RouteTest extends BaseTestCase
{
public function testEmptyPrefix(): void
{
@@ -21,9 +22,7 @@ public function testEmptyPrefix(): void
$this->assertSame('', $route->getUriHandler()->getPrefix());
}
- /**
- * @dataProvider prefixesDataProvider
- */
+ #[DataProvider('prefixesDataProvider')]
public function testPrefix(string $prefix, string $expected): void
{
$route = new Route('/action', Call::class);
@@ -40,7 +39,7 @@ public function testContainerException(): void
$route->handle(new ServerRequest('GET', ''));
}
- /** @dataProvider middlewaresDataProvider */
+ #[DataProvider('middlewaresDataProvider')]
public function testWithMiddleware(mixed $middleware): void
{
$route = new Route('/action', Call::class);
@@ -55,7 +54,7 @@ public function testWithMiddleware(mixed $middleware): void
$this->assertInstanceOf(TestMiddleware::class, $m[0]);
}
- public function prefixesDataProvider(): \Traversable
+ public static function prefixesDataProvider(): \Traversable
{
yield ['something', 'something'];
yield ['/something/', 'something'];
diff --git a/src/Router/tests/RouterTest.php b/src/Router/tests/RouterTest.php
index 41d6371ae..79ada92b4 100644
--- a/src/Router/tests/RouterTest.php
+++ b/src/Router/tests/RouterTest.php
@@ -13,7 +13,7 @@
use Spiral\Router\Exception\UndefinedRouteException;
use Spiral\Router\Route;
-class RouterTest extends BaseTest
+class RouterTest extends BaseTestCase
{
public function testGetRoutes(): void
{
diff --git a/src/Router/tests/SingleActionTest.php b/src/Router/tests/SingleActionTest.php
index ebfdeb2de..278919cda 100644
--- a/src/Router/tests/SingleActionTest.php
+++ b/src/Router/tests/SingleActionTest.php
@@ -12,7 +12,7 @@
use Nyholm\Psr7\ServerRequest;
use Nyholm\Psr7\Uri;
-class SingleActionTest extends BaseTest
+class SingleActionTest extends BaseTestCase
{
public function testRouteException(): void
{
diff --git a/src/Router/tests/Targets/NamespacedTargetTest.php b/src/Router/tests/Targets/NamespacedTargetTest.php
index 362fa9386..f5bed2baf 100644
--- a/src/Router/tests/Targets/NamespacedTargetTest.php
+++ b/src/Router/tests/Targets/NamespacedTargetTest.php
@@ -4,6 +4,7 @@
namespace Spiral\Tests\Router\Targets;
+use PHPUnit\Framework\Attributes\DataProvider;
use PHPUnit\Framework\TestCase;
use Spiral\Router\Exception\ConstrainException;
use Spiral\Router\Route;
@@ -74,13 +75,7 @@ public function testMatch(): void
$this->assertSame(['controller' => 'other', 'action' => 'action'], $match->getMatches());
}
- /**
- * @dataProvider defaultProvider
- *
- * @param string $pattern
- * @param string $uri
- * @param array $defaults
- */
+ #[DataProvider('defaultProvider')]
public function testDefaults(string $pattern, string $uri, array $defaults): void
{
$route = new Route($pattern, new Namespaced('Spiral\Router\Fixtures'), $defaults);
@@ -96,23 +91,21 @@ public function testDefaults(string $pattern, string $uri, array $defaults): voi
$this->assertNotNull($values['action']);
}
- public function defaultProvider(): array
+ public static function defaultProvider(): \Traversable
{
- return [
- ['[/]', '/home', ['controller' => 'home', 'action' => 'test']],
- ['[/]', '/home/test', ['controller' => 'home', 'action' => 'test']],
- ['/[/]', '/home', ['controller' => 'home', 'action' => 'test']],
- ['/[/]', '/home/test', ['controller' => 'home', 'action' => 'test']],
-
- ['[[/]]', '/home', ['controller' => 'home', 'action' => 'test']],
- ['[[/]]', '/home/test', ['controller' => 'home', 'action' => 'test']],
- ['[[/]]', '/', ['controller' => 'home', 'action' => 'test']],
- ['[[/]]', '', ['controller' => 'home', 'action' => 'test']],
-
- ['[/[/]]', '/home', ['controller' => 'home', 'action' => 'test']],
- ['[/[/]]', '/home/test', ['controller' => 'home', 'action' => 'test']],
- ['[/[/]]', '/', ['controller' => 'home', 'action' => 'test']],
- ['[/[/]]', '', ['controller' => 'home', 'action' => 'test']],
- ];
+ yield ['[/]', '/home', ['controller' => 'home', 'action' => 'test']];
+ yield ['[/]', '/home/test', ['controller' => 'home', 'action' => 'test']];
+ yield ['/[/]', '/home', ['controller' => 'home', 'action' => 'test']];
+ yield ['/[/]', '/home/test', ['controller' => 'home', 'action' => 'test']];
+
+ yield ['[[/]]', '/home', ['controller' => 'home', 'action' => 'test']];
+ yield ['[[/]]', '/home/test', ['controller' => 'home', 'action' => 'test']];
+ yield ['[[/]]', '/', ['controller' => 'home', 'action' => 'test']];
+ yield ['[[/]]', '', ['controller' => 'home', 'action' => 'test']];
+
+ yield ['[/[/]]', '/home', ['controller' => 'home', 'action' => 'test']];
+ yield ['[/[/]]', '/home/test', ['controller' => 'home', 'action' => 'test']];
+ yield ['[/[/]]', '/', ['controller' => 'home', 'action' => 'test']];
+ yield ['[/[/]]', '', ['controller' => 'home', 'action' => 'test']];
}
}
diff --git a/src/Router/tests/UriTest.php b/src/Router/tests/UriTest.php
index 0106fe01b..ee5ee42fe 100644
--- a/src/Router/tests/UriTest.php
+++ b/src/Router/tests/UriTest.php
@@ -9,7 +9,7 @@
use Spiral\Router\Target\Group;
use Spiral\Tests\Router\Fixtures\TestController;
-class UriTest extends BaseTest
+class UriTest extends BaseTestCase
{
public function testCastRoute(): void
{
diff --git a/src/Scaffolder/composer.json b/src/Scaffolder/composer.json
index d40280a4e..8b47509ec 100644
--- a/src/Scaffolder/composer.json
+++ b/src/Scaffolder/composer.json
@@ -39,7 +39,7 @@
"nette/php-generator": "^4.0.1"
},
"require-dev": {
- "phpunit/phpunit": "^9.5.20",
+ "phpunit/phpunit": "^10.1",
"spiral/framework": "^3.1",
"vimeo/psalm": "^5.9"
},
diff --git a/src/Scaffolder/tests/BaseTest.php b/src/Scaffolder/tests/BaseTestCase.php
similarity index 72%
rename from src/Scaffolder/tests/BaseTest.php
rename to src/Scaffolder/tests/BaseTestCase.php
index 29d529570..0b5356365 100644
--- a/src/Scaffolder/tests/BaseTest.php
+++ b/src/Scaffolder/tests/BaseTestCase.php
@@ -4,14 +4,13 @@
namespace Spiral\Tests\Scaffolder;
+use PHPUnit\Framework\Attributes\RequiresFunction;
use PHPUnit\Framework\TestCase;
use Spiral\Tests\Scaffolder\App\TestApp;
use Throwable;
-/**
- * @requires function \Spiral\Framework\Kernel::init
- */
-abstract class BaseTest extends TestCase
+#[RequiresFunction('\Spiral\Framework\Kernel::init')]
+abstract class BaseTestCase extends TestCase
{
/** @var TestApp */
protected $app;
diff --git a/src/Scaffolder/tests/Command/AbstractCommandTest.php b/src/Scaffolder/tests/Command/AbstractCommandTestCase.php
similarity index 92%
rename from src/Scaffolder/tests/Command/AbstractCommandTest.php
rename to src/Scaffolder/tests/Command/AbstractCommandTestCase.php
index d43900a08..b9015b3f7 100644
--- a/src/Scaffolder/tests/Command/AbstractCommandTest.php
+++ b/src/Scaffolder/tests/Command/AbstractCommandTestCase.php
@@ -7,10 +7,10 @@
use ReflectionClass;
use Spiral\Console\Console;
use Spiral\Files\FilesInterface;
-use Spiral\Tests\Scaffolder\BaseTest;
+use Spiral\Tests\Scaffolder\BaseTestCase;
use Throwable;
-abstract class AbstractCommandTest extends BaseTest
+abstract class AbstractCommandTestCase extends BaseTestCase
{
protected ?string $className = null;
diff --git a/src/Scaffolder/tests/Command/BootloaderTest.php b/src/Scaffolder/tests/Command/BootloaderTest.php
index 4eee39b37..72f5eb956 100644
--- a/src/Scaffolder/tests/Command/BootloaderTest.php
+++ b/src/Scaffolder/tests/Command/BootloaderTest.php
@@ -9,7 +9,7 @@
use Spiral\Core\CoreInterface;
use Throwable;
-class BootloaderTest extends AbstractCommandTest
+class BootloaderTest extends AbstractCommandTestCase
{
/**
* @throws ReflectionException
diff --git a/src/Scaffolder/tests/Command/CommandNamespaceTest.php b/src/Scaffolder/tests/Command/CommandNamespaceTest.php
index 21ab3b353..c242953d7 100644
--- a/src/Scaffolder/tests/Command/CommandNamespaceTest.php
+++ b/src/Scaffolder/tests/Command/CommandNamespaceTest.php
@@ -10,7 +10,7 @@
use Spiral\Scaffolder\Declaration\CommandDeclaration;
use Spiral\Scaffolder\Declaration\DeclarationInterface;
-final class CommandNamespaceTest extends AbstractCommandTest
+final class CommandNamespaceTest extends AbstractCommandTestCase
{
public function testCommandWithoutNamespaceOption(): void
{
@@ -82,4 +82,4 @@ public function testCommandWithCommentOption(): void
$this->assertSame(Command::SUCCESS, $output->getCode());
}
-}
\ No newline at end of file
+}
diff --git a/src/Scaffolder/tests/Command/CommandTest.php b/src/Scaffolder/tests/Command/CommandTest.php
index aaaafec81..ea2a7f16e 100644
--- a/src/Scaffolder/tests/Command/CommandTest.php
+++ b/src/Scaffolder/tests/Command/CommandTest.php
@@ -4,20 +4,16 @@
namespace Spiral\Tests\Scaffolder\Command;
+use PHPUnit\Framework\Attributes\DataProvider;
use ReflectionClass;
-use ReflectionException;
use Spiral\Console\Attribute\Argument;
use Spiral\Console\Attribute\AsCommand;
use Spiral\Console\Attribute\Option;
use Spiral\Console\Attribute\Question;
-use Throwable;
-final class CommandTest extends AbstractCommandTest
+final class CommandTest extends AbstractCommandTestCase
{
-
- /**
- * @dataProvider commandDataProvider
- */
+ #[DataProvider('commandDataProvider')]
public function testScaffold(string $className, string $name, ?string $alias, $commandName): void
{
$this->className = $className;
@@ -122,17 +118,15 @@ public function testScaffoldWithCustomNamespace(): void
$this->assertStringContainsString('App\Custom\Command', $content);
}
- public function commandDataProvider(): array
+ public static function commandDataProvider(): \Traversable
{
- return [
- ['\\Spiral\\Tests\\Scaffolder\\App\\Command\\SampleCommand', 'sample', null, 'sample'],
- ['\\Spiral\\Tests\\Scaffolder\\App\\Command\\SomeCommand', 'SomeCommand', null, 'some:command'],
- [
- '\\Spiral\\Tests\\Scaffolder\\App\\Command\\SampleAliasCommand',
- 'sampleAlias',
- 'my-sample-command-alias',
- 'my-sample-command-alias',
- ],
+ yield ['\\Spiral\\Tests\\Scaffolder\\App\\Command\\SampleCommand', 'sample', null, 'sample'];
+ yield ['\\Spiral\\Tests\\Scaffolder\\App\\Command\\SomeCommand', 'SomeCommand', null, 'some:command'];
+ yield [
+ '\\Spiral\\Tests\\Scaffolder\\App\\Command\\SampleAliasCommand',
+ 'sampleAlias',
+ 'my-sample-command-alias',
+ 'my-sample-command-alias',
];
}
}
diff --git a/src/Scaffolder/tests/Command/ConfigTest.php b/src/Scaffolder/tests/Command/ConfigTest.php
index 75abec753..85069e2a6 100644
--- a/src/Scaffolder/tests/Command/ConfigTest.php
+++ b/src/Scaffolder/tests/Command/ConfigTest.php
@@ -9,7 +9,7 @@
use Symfony\Component\Console\Input\StringInput;
use Throwable;
-class ConfigTest extends AbstractCommandTest
+class ConfigTest extends AbstractCommandTestCase
{
/**
* @throws ReflectionException
diff --git a/src/Scaffolder/tests/Command/ControllerTest.php b/src/Scaffolder/tests/Command/ControllerTest.php
index c6bcb8d4b..fe874c264 100644
--- a/src/Scaffolder/tests/Command/ControllerTest.php
+++ b/src/Scaffolder/tests/Command/ControllerTest.php
@@ -9,7 +9,7 @@
use Spiral\Prototype\Traits\PrototypeTrait;
use Throwable;
-class ControllerTest extends AbstractCommandTest
+class ControllerTest extends AbstractCommandTestCase
{
/**
* @throws ReflectionException
diff --git a/src/Scaffolder/tests/Command/FilterCommandTest.php b/src/Scaffolder/tests/Command/FilterCommandTest.php
index fefca6d00..e0f2cc522 100644
--- a/src/Scaffolder/tests/Command/FilterCommandTest.php
+++ b/src/Scaffolder/tests/Command/FilterCommandTest.php
@@ -6,7 +6,7 @@
use Spiral\Filters\Model\Filter;
-final class FilterCommandTest extends AbstractCommandTest
+final class FilterCommandTest extends AbstractCommandTestCase
{
public function testScaffold(): void
{
@@ -104,4 +104,4 @@ public function testCreateProperty(): void
$this->assertStringContainsString('#[BearerToken(key: \'token\')]', $content);
$this->assertStringContainsString('public string $token;', $content);
}
-}
\ No newline at end of file
+}
diff --git a/src/Scaffolder/tests/Command/JobHandlerTest.php b/src/Scaffolder/tests/Command/JobHandlerTest.php
index b77ff4f7b..178097d7c 100644
--- a/src/Scaffolder/tests/Command/JobHandlerTest.php
+++ b/src/Scaffolder/tests/Command/JobHandlerTest.php
@@ -8,7 +8,7 @@
use ReflectionException;
use Throwable;
-class JobHandlerTest extends AbstractCommandTest
+class JobHandlerTest extends AbstractCommandTestCase
{
/**
* @throws ReflectionException
diff --git a/src/Scaffolder/tests/Command/MiddlewareTest.php b/src/Scaffolder/tests/Command/MiddlewareTest.php
index f59bb2cca..30a3bea3c 100644
--- a/src/Scaffolder/tests/Command/MiddlewareTest.php
+++ b/src/Scaffolder/tests/Command/MiddlewareTest.php
@@ -8,7 +8,7 @@
use ReflectionException;
use Throwable;
-class MiddlewareTest extends AbstractCommandTest
+class MiddlewareTest extends AbstractCommandTestCase
{
/**
* @throws ReflectionException
diff --git a/src/Scaffolder/tests/Command/NamespacedNameTest.php b/src/Scaffolder/tests/Command/NamespacedNameTest.php
index b0267c039..82b900aab 100644
--- a/src/Scaffolder/tests/Command/NamespacedNameTest.php
+++ b/src/Scaffolder/tests/Command/NamespacedNameTest.php
@@ -8,7 +8,7 @@
use ReflectionException;
use Throwable;
-class NamespacedNameTest extends AbstractCommandTest
+class NamespacedNameTest extends AbstractCommandTestCase
{
private const CLASS_NAME = '\\Spiral\\Tests\\Scaffolder\\App\\Controller\\Namespaced\\SampleController';
diff --git a/src/Scaffolder/tests/Config/ScaffolderConfigTest.php b/src/Scaffolder/tests/Config/ScaffolderConfigTest.php
index 624dc9ac0..dcb78a891 100644
--- a/src/Scaffolder/tests/Config/ScaffolderConfigTest.php
+++ b/src/Scaffolder/tests/Config/ScaffolderConfigTest.php
@@ -8,9 +8,9 @@
use Spiral\Scaffolder\Config\ScaffolderConfig;
use Spiral\Scaffolder\Declaration\BootloaderDeclaration;
use Spiral\Scaffolder\Exception\ScaffolderException;
-use Spiral\Tests\Scaffolder\BaseTest;
+use Spiral\Tests\Scaffolder\BaseTestCase;
-class ScaffolderConfigTest extends BaseTest
+class ScaffolderConfigTest extends BaseTestCase
{
public function testDefaultBaseNamespace(): void
{
diff --git a/src/Scaffolder/tests/FunctionsTest.php b/src/Scaffolder/tests/FunctionsTest.php
index cd1580962..158591d34 100644
--- a/src/Scaffolder/tests/FunctionsTest.php
+++ b/src/Scaffolder/tests/FunctionsTest.php
@@ -4,37 +4,28 @@
namespace Spiral\Tests\Scaffolder;
+use PHPUnit\Framework\Attributes\DataProvider;
use PHPUnit\Framework\TestCase;
use function Spiral\Scaffolder\defineArrayType;
class FunctionsTest extends TestCase
{
- /**
- * @dataProvider defineProvider
- * @param mixed $expected
- * @param array $array
- * @param string|null $failureType
- */
- public function testDefineArrayType($expected, array $array, ?string $failureType): void
+ #[DataProvider('defineProvider')]
+ public function testDefineArrayType(?string $expected, array $array, ?string $failureType): void
{
$this->assertEquals($expected, defineArrayType($array, $failureType));
}
- /**
- * @return array
- */
- public function defineProvider(): array
+ public static function defineProvider(): \Traversable
{
- return [
- //valid
- ['integer', [1, 2, 3], null],
- ['NULL', [null, null], null],
+ //valid
+ yield ['integer', [1, 2, 3], null];
+ yield ['NULL', [null, null], null];
- //mixed
- [null, [1, '2', 3], null],
- [null, [null, 'null'], null],
- ['mixed', [null, 'null'], 'mixed'],
- ];
+ //mixed
+ yield [null, [1, '2', 3], null];
+ yield [null, [null, 'null'], null];
+ yield ['mixed', [null, 'null'], 'mixed'];
}
}
diff --git a/src/Security/composer.json b/src/Security/composer.json
index 2d00af0d1..783cc5915 100644
--- a/src/Security/composer.json
+++ b/src/Security/composer.json
@@ -38,7 +38,7 @@
},
"require-dev": {
"spiral/console": "^3.8",
- "phpunit/phpunit": "^9.5.20",
+ "phpunit/phpunit": "^10.1",
"mockery/mockery": "^1.5",
"vimeo/psalm": "^5.9"
},
diff --git a/src/Security/tests/GuardTest.php b/src/Security/tests/GuardTest.php
index d8d299017..f5add45ec 100644
--- a/src/Security/tests/GuardTest.php
+++ b/src/Security/tests/GuardTest.php
@@ -40,8 +40,17 @@ public function setUp(): void
public function testAllows(): void
{
$this->permission->method('hasRole')
- ->withConsecutive(['user'], ['admin'])
- ->willReturnOnConsecutiveCalls(false, true);
+ ->willReturnCallback(function (...$args) {
+ static $series = [
+ [['user'], false],
+ [['admin'], true],
+ ];
+
+ [$expectedArgs, $return] = \array_shift($series);
+ self::assertSame($expectedArgs, $args);
+
+ return $return;
+ });
$rule = $this->createMock(RuleInterface::class);
$rule->expects($this->once())
diff --git a/src/Security/tests/PermissionManagerTest.php b/src/Security/tests/PermissionManagerTest.php
index 5acfa5059..920d02540 100644
--- a/src/Security/tests/PermissionManagerTest.php
+++ b/src/Security/tests/PermissionManagerTest.php
@@ -70,10 +70,20 @@ public function testAssociation(): void
$allowRule = new AllowRule();
$forbidRule = new ForbidRule();
+ $series = [
+ [[AllowRule::class], $allowRule],
+ [[AllowRule::class], $allowRule],
+ [[ForbidRule::class], $forbidRule],
+ ];
+
$this->rules->method('has')->willReturn(true);
$this->rules->method('get')
- ->withConsecutive([AllowRule::class], [AllowRule::class], [ForbidRule::class])
- ->willReturn($allowRule, $allowRule, $forbidRule);
+ ->willReturnCallback(function (...$args) use (&$series) {
+ [$expectedArgs, $return] = \array_shift($series);
+ self::assertSame($expectedArgs, $args);
+
+ return $return;
+ });
$manager = new PermissionManager($this->rules);
$manager->addRole(static::ROLE);
@@ -127,7 +137,7 @@ public function testGetFallbackRule(): void
$manager->addRole(static::ROLE);
$this->rules->method('get')
- ->withConsecutive([ForbidRule::class])
+ ->with(ForbidRule::class)
->willReturn(new ForbidRule());
$this->assertInstanceOf(
diff --git a/src/Security/tests/RuleTest.php b/src/Security/tests/RuleTest.php
index d880fb136..b3aabe436 100644
--- a/src/Security/tests/RuleTest.php
+++ b/src/Security/tests/RuleTest.php
@@ -4,6 +4,7 @@
namespace Spiral\Tests\Security;
+use PHPUnit\Framework\Attributes\DataProvider;
use PHPUnit\Framework\TestCase;
use Spiral\Core\ResolverInterface;
use Spiral\Security\ActorInterface;
@@ -41,17 +42,11 @@ protected function setUp(): void
$this->resolver = $this->createMock(ResolverInterface::class);
$this->rule = $this->getMockBuilder(Rule::class)
->setConstructorArgs([$this->resolver])
- ->setMethods(['check'])->getMock();
+ ->addMethods(['check'])->getMock();
}
- /**
- * @param $permission
- * @param $context
- * @param $allowed
- *
- * @dataProvider allowsProvider
- */
- public function testAllows($permission, $context, $allowed): void
+ #[DataProvider('allowsProvider')]
+ public function testAllows(string $permission, array $context, bool $allowed): void
{
$parameters = [
'actor' => $this->actor,
@@ -82,16 +77,11 @@ public function testAllowsException(): void
$this->rule->allows($this->actor, static::OPERATION, static::CONTEXT);
}
- /**
- * @return array
- */
- public function allowsProvider()
+ public static function allowsProvider(): \Traversable
{
- return [
- ['test.create', [], false],
- ['test.create', [], true],
- ['test.create', ['a' => 'b'], false],
- ['test.create', ['a' => 'b'], true],
- ];
+ yield ['test.create', [], false];
+ yield ['test.create', [], true];
+ yield ['test.create', ['a' => 'b'], false];
+ yield ['test.create', ['a' => 'b'], true];
}
}
diff --git a/src/Security/tests/Rules/CallableRuleTest.php b/src/Security/tests/Rules/CallableRuleTest.php
index a735457b4..1af470bb4 100644
--- a/src/Security/tests/Rules/CallableRuleTest.php
+++ b/src/Security/tests/Rules/CallableRuleTest.php
@@ -22,7 +22,7 @@ public function testAllow(): void
/** @var \PHPUnit_Framework_MockObject_MockObject|callable $callable */
$callable = $this->getMockBuilder(\stdClass::class)
- ->setMethods(['__invoke'])
+ ->addMethods(['__invoke'])
->getMock();
$callable->method('__invoke')
diff --git a/src/Security/tests/Rules/CompositeRuleTest.php b/src/Security/tests/Rules/CompositeRuleTest.php
index 7a245462c..9c998cab5 100644
--- a/src/Security/tests/Rules/CompositeRuleTest.php
+++ b/src/Security/tests/Rules/CompositeRuleTest.php
@@ -4,6 +4,7 @@
namespace Spiral\Tests\Security\Rules;
+use PHPUnit\Framework\Attributes\DataProvider;
use PHPUnit\Framework\MockObject\Stub\ConsecutiveCalls;
use PHPUnit\Framework\TestCase;
use Spiral\Security\ActorInterface;
@@ -27,14 +28,8 @@ public function setUp(): void
$this->actor = $this->createMock(ActorInterface::class);
}
- /**
- * @param $expected
- * @param $compositeRuleClass
- * @param $rules
- *
- * @dataProvider allowsProvider
- */
- public function testAllow($expected, $compositeRuleClass, $rules): void
+ #[DataProvider('allowsProvider')]
+ public function testAllow(bool $expected, string $compositeRuleClass, array $rules): void
{
$repository = $this->createRepository($rules);
@@ -46,18 +41,16 @@ public function testAllow($expected, $compositeRuleClass, $rules): void
);
}
- public function allowsProvider()
+ public static function allowsProvider(): \Traversable
{
- $allowRule = $this->allowRule();
- $forbidRule = $this->forbidRule();
-
- return [
- [true, AllCompositeRule::class, [$allowRule, $allowRule, $allowRule]],
- [false, AllCompositeRule::class, [$allowRule, $allowRule, $forbidRule]],
- [true, OneCompositeRule::class, [$allowRule, $forbidRule, $forbidRule]],
- [true, OneCompositeRule::class, [$allowRule, $allowRule, $allowRule]],
- [false, OneCompositeRule::class, [$forbidRule, $forbidRule, $forbidRule]],
- ];
+ $allowRule = self::allowRule();
+ $forbidRule = self::forbidRule();
+
+ yield [true, AllCompositeRule::class, [$allowRule, $allowRule, $allowRule]];
+ yield [false, AllCompositeRule::class, [$allowRule, $allowRule, $forbidRule]];
+ yield [true, OneCompositeRule::class, [$allowRule, $forbidRule, $forbidRule]];
+ yield [true, OneCompositeRule::class, [$allowRule, $allowRule, $allowRule]];
+ yield [false, OneCompositeRule::class, [$forbidRule, $forbidRule, $forbidRule]];
}
/**
@@ -76,26 +69,18 @@ private function createRepository(array $rules): RulesInterface
return $repository;
}
- /**
- * @return RuleInterface
- */
- private function allowRule(): RuleInterface
+ private static function allowRule(): RuleInterface
{
- /** @var \PHPUnit_Framework_MockObject_MockObject|RuleInterface $rule */
- $rule = $this->createMock(RuleInterface::class);
- $rule->method('allows')->willReturn(true);
+ $rule = \Mockery::mock(RuleInterface::class);
+ $rule->shouldReceive('allows')->andReturnTrue();
return $rule;
}
- /**
- * @return RuleInterface
- */
- private function forbidRule(): RuleInterface
+ private static function forbidRule(): RuleInterface
{
- /** @var \PHPUnit_Framework_MockObject_MockObject|RuleInterface $rule */
- $rule = $this->createMock(RuleInterface::class);
- $rule->method('allows')->willReturn(false);
+ $rule = \Mockery::mock(RuleInterface::class);
+ $rule->shouldReceive('allows')->andReturnFalse();
return $rule;
}
diff --git a/src/SendIt/composer.json b/src/SendIt/composer.json
index f85d4a15d..1201a932f 100644
--- a/src/SendIt/composer.json
+++ b/src/SendIt/composer.json
@@ -38,7 +38,7 @@
"psr/event-dispatcher": "^1.0"
},
"require-dev": {
- "phpunit/phpunit": "^9.5.20",
+ "phpunit/phpunit": "^10.1",
"mockery/mockery": "^1.5",
"spiral/boot": "^3.8",
"spiral/stempler-bridge": "^3.8",
diff --git a/src/SendIt/tests/TransportResolverTest.php b/src/SendIt/tests/TransportResolverTest.php
index 5410d6444..f3d1b070c 100644
--- a/src/SendIt/tests/TransportResolverTest.php
+++ b/src/SendIt/tests/TransportResolverTest.php
@@ -58,7 +58,7 @@ public function testCanResolveRegisteredDefaultTransport(): void
public function testNotRegisteredTransportShouldTrowAnException(): void
{
$this->expectException(UnsupportedSchemeException::class);
- $this->expectErrorMessage('The "smtp" scheme is not supported.');
+ $this->expectExceptionMessage('The "smtp" scheme is not supported.');
$transportFactory = m::mock(TransportFactoryInterface::class);
$transportFactory->shouldReceive('supports')->once()->andReturn(false);
diff --git a/src/Serializer/composer.json b/src/Serializer/composer.json
index 06a023447..916173422 100644
--- a/src/Serializer/composer.json
+++ b/src/Serializer/composer.json
@@ -19,7 +19,7 @@
},
"require-dev": {
"spiral/boot": "^3.8",
- "phpunit/phpunit": "^9.5.20",
+ "phpunit/phpunit": "^10.1",
"vimeo/psalm": "^5.9"
},
"autoload-dev": {
diff --git a/src/Serializer/tests/SerializerManagerTest.php b/src/Serializer/tests/SerializerManagerTest.php
index f11b2ef8e..7ee1e30bc 100644
--- a/src/Serializer/tests/SerializerManagerTest.php
+++ b/src/Serializer/tests/SerializerManagerTest.php
@@ -4,6 +4,7 @@
namespace Spiral\Tests\Serializer;
+use PHPUnit\Framework\Attributes\DataProvider;
use PHPUnit\Framework\TestCase;
use Spiral\Serializer\Exception\SerializerNotFoundException;
use Spiral\Serializer\Serializer\JsonSerializer;
@@ -35,7 +36,7 @@ public function testGetSerializer(): void
$this->serializer->getSerializer('bad');
}
- /** @dataProvider serializeDataProvider */
+ #[DataProvider('serializeDataProvider')]
public function testSerialize(mixed $payload, string $expected, ?string $format = null): void
{
$this->assertSame($expected, $this->serializer->serialize($payload, $format));
@@ -50,20 +51,20 @@ public function testBadSerializer(): void
$this->serializer->unserialize('payload', 'bad');
}
- /** @dataProvider unserializeDataProvider */
+ #[DataProvider('unserializeDataProvider')]
public function testUnserialize(string|\Stringable $payload, mixed $expected, ?string $format = null): void
{
$this->assertSame($expected, $this->serializer->unserialize($payload, format: $format));
}
- public function serializeDataProvider(): \Traversable
+ public static function serializeDataProvider(): \Traversable
{
yield [['some', 'elements'], '["some","elements"]', 'json'];
yield [['some', 'elements'], 'a:2:{i:0;s:4:"some";i:1;s:8:"elements";}', 'serializer'];
yield [['some', 'elements'], '["some","elements"]'];
}
- public function unserializeDataProvider(): \Traversable
+ public static function unserializeDataProvider(): \Traversable
{
yield ['["some","elements"]', ['some', 'elements'], 'json'];
yield [new class() implements \Stringable {
diff --git a/src/Session/composer.json b/src/Session/composer.json
index 1f35c9f3c..dd0f43453 100644
--- a/src/Session/composer.json
+++ b/src/Session/composer.json
@@ -33,7 +33,7 @@
"spiral/cache": "^3.8"
},
"require-dev": {
- "phpunit/phpunit": "^9.5.20",
+ "phpunit/phpunit": "^10.1",
"vimeo/psalm": "^5.9",
"mockery/mockery": "^1.5"
},
diff --git a/src/Snapshots/composer.json b/src/Snapshots/composer.json
index c2e3fcd47..f3aea3049 100644
--- a/src/Snapshots/composer.json
+++ b/src/Snapshots/composer.json
@@ -33,7 +33,7 @@
"symfony/finder": "^5.3.7|^6.0"
},
"require-dev": {
- "phpunit/phpunit": "^9.5.20",
+ "phpunit/phpunit": "^10.1",
"vimeo/psalm": "^5.9"
},
"autoload": {
diff --git a/src/Stempler/composer.json b/src/Stempler/composer.json
index f25148b53..25adea39f 100644
--- a/src/Stempler/composer.json
+++ b/src/Stempler/composer.json
@@ -33,7 +33,7 @@
"spiral/core": "^3.8"
},
"require-dev": {
- "phpunit/phpunit": "^9.5.20",
+ "phpunit/phpunit": "^10.1",
"mockery/mockery": "^1.5",
"vimeo/psalm": "^5.9"
},
diff --git a/src/Stempler/tests/Compiler/BaseTest.php b/src/Stempler/tests/Compiler/BaseTestCase.php
similarity index 96%
rename from src/Stempler/tests/Compiler/BaseTest.php
rename to src/Stempler/tests/Compiler/BaseTestCase.php
index e8c100e70..7aec8dc39 100644
--- a/src/Stempler/tests/Compiler/BaseTest.php
+++ b/src/Stempler/tests/Compiler/BaseTestCase.php
@@ -10,7 +10,7 @@
use Spiral\Stempler\Node\Template;
use Spiral\Stempler\Parser;
-abstract class BaseTest extends TestCase
+abstract class BaseTestCase extends TestCase
{
protected const GRAMMARS = [
/* GRAMMAR => SYNTAX */
diff --git a/src/Stempler/tests/Compiler/DynamicTest.php b/src/Stempler/tests/Compiler/DynamicTest.php
index c31bd0a55..21742ea95 100644
--- a/src/Stempler/tests/Compiler/DynamicTest.php
+++ b/src/Stempler/tests/Compiler/DynamicTest.php
@@ -12,7 +12,7 @@
use Spiral\Stempler\Parser\Syntax\DynamicSyntax;
use Spiral\Stempler\Parser\Syntax\HTMLSyntax;
-class DynamicTest extends BaseTest
+class DynamicTest extends BaseTestCase
{
protected const RENDERS = [
CoreRenderer::class,
diff --git a/src/Stempler/tests/Compiler/HTMLTest.php b/src/Stempler/tests/Compiler/HTMLTest.php
index 45f507263..2aac48bd7 100644
--- a/src/Stempler/tests/Compiler/HTMLTest.php
+++ b/src/Stempler/tests/Compiler/HTMLTest.php
@@ -9,7 +9,7 @@
use Spiral\Stempler\Lexer\Grammar\HTMLGrammar;
use Spiral\Stempler\Parser\Syntax\HTMLSyntax;
-class HTMLTest extends BaseTest
+class HTMLTest extends BaseTestCase
{
protected const RENDERS = [
CoreRenderer::class,
diff --git a/src/Stempler/tests/Compiler/RawTest.php b/src/Stempler/tests/Compiler/RawTest.php
index bd1915708..b07015f92 100644
--- a/src/Stempler/tests/Compiler/RawTest.php
+++ b/src/Stempler/tests/Compiler/RawTest.php
@@ -6,7 +6,7 @@
use Spiral\Stempler\Compiler\Renderer\CoreRenderer;
-class RawTest extends BaseTest
+class RawTest extends BaseTestCase
{
protected const RENDERS = [
CoreRenderer::class,
diff --git a/src/Stempler/tests/Directive/BaseTest.php b/src/Stempler/tests/Directive/BaseTestCase.php
similarity index 94%
rename from src/Stempler/tests/Directive/BaseTest.php
rename to src/Stempler/tests/Directive/BaseTestCase.php
index 08b050ad8..1349f14a6 100644
--- a/src/Stempler/tests/Directive/BaseTest.php
+++ b/src/Stempler/tests/Directive/BaseTestCase.php
@@ -14,7 +14,7 @@
use Spiral\Stempler\Parser\Syntax\DynamicSyntax;
use Spiral\Stempler\Parser\Syntax\HTMLSyntax;
-abstract class BaseTest extends \Spiral\Tests\Stempler\Compiler\BaseTest
+abstract class BaseTestCase extends \Spiral\Tests\Stempler\Compiler\BaseTestCase
{
protected const RENDERS = [
CoreRenderer::class,
diff --git a/src/Stempler/tests/Directive/ConditionalTest.php b/src/Stempler/tests/Directive/ConditionalTest.php
index 108b9db6d..b7bb0a9a5 100644
--- a/src/Stempler/tests/Directive/ConditionalTest.php
+++ b/src/Stempler/tests/Directive/ConditionalTest.php
@@ -6,7 +6,7 @@
use Spiral\Stempler\Directive\ConditionalDirective;
-class ConditionalTest extends BaseTest
+class ConditionalTest extends BaseTestCase
{
protected const DIRECTIVES = [
ConditionalDirective::class
diff --git a/src/Stempler/tests/Directive/JsonTest.php b/src/Stempler/tests/Directive/JsonTest.php
index 3dd53c2b2..c8e869d77 100644
--- a/src/Stempler/tests/Directive/JsonTest.php
+++ b/src/Stempler/tests/Directive/JsonTest.php
@@ -6,7 +6,7 @@
use Spiral\Stempler\Directive\JsonDirective;
-class JsonTest extends BaseTest
+class JsonTest extends BaseTestCase
{
protected const DIRECTIVES = [
JsonDirective::class
diff --git a/src/Stempler/tests/Directive/LoopTest.php b/src/Stempler/tests/Directive/LoopTest.php
index f451708e4..4c4994b9c 100644
--- a/src/Stempler/tests/Directive/LoopTest.php
+++ b/src/Stempler/tests/Directive/LoopTest.php
@@ -6,7 +6,7 @@
use Spiral\Stempler\Directive\LoopDirective;
-class LoopTest extends BaseTest
+class LoopTest extends BaseTestCase
{
protected const DIRECTIVES = [
LoopDirective::class
diff --git a/src/Stempler/tests/Directive/OnlyKnownTest.php b/src/Stempler/tests/Directive/OnlyKnownTest.php
index cf22de8e8..8011dde63 100644
--- a/src/Stempler/tests/Directive/OnlyKnownTest.php
+++ b/src/Stempler/tests/Directive/OnlyKnownTest.php
@@ -13,7 +13,7 @@
use Spiral\Stempler\Parser;
use Spiral\Stempler\Parser\Syntax\HTMLSyntax;
-class OnlyKnownTest extends BaseTest
+class OnlyKnownTest extends BaseTestCase
{
protected const DIRECTIVES = [
LoopDirective::class
diff --git a/src/Stempler/tests/Directive/PHPTest.php b/src/Stempler/tests/Directive/PHPTest.php
index 1f04838dd..e5e87835a 100644
--- a/src/Stempler/tests/Directive/PHPTest.php
+++ b/src/Stempler/tests/Directive/PHPTest.php
@@ -6,7 +6,7 @@
use Spiral\Stempler\Directive\PHPDirective;
-class PHPTest extends BaseTest
+class PHPTest extends BaseTestCase
{
protected const DIRECTIVES = [
PHPDirective::class
diff --git a/src/Stempler/tests/ExceptionTest.php b/src/Stempler/tests/ExceptionTest.php
index b4139bc9a..a6c2c7e42 100644
--- a/src/Stempler/tests/ExceptionTest.php
+++ b/src/Stempler/tests/ExceptionTest.php
@@ -13,14 +13,14 @@
use Spiral\Stempler\Exception\ParserException;
use Spiral\Stempler\Exception\SyntaxException;
use Spiral\Stempler\Loader\LoaderInterface;
-use Spiral\Tests\Stempler\Transform\BaseTest;
+use Spiral\Tests\Stempler\Transform\BaseTestCase;
use Spiral\Stempler\Transform\Finalizer\DynamicToPHP;
use Spiral\Stempler\Transform\Merge\ExtendsParent;
use Spiral\Stempler\Transform\Merge\ResolveImports;
use Spiral\Stempler\Transform\Visitor\DefineAttributes;
use Spiral\Stempler\Transform\Visitor\DefineBlocks;
-class ExceptionTest extends BaseTest
+class ExceptionTest extends BaseTestCase
{
public function testSimpleLoad(): void
{
diff --git a/src/Stempler/tests/Grammar/BaseTest.php b/src/Stempler/tests/Grammar/BaseTestCase.php
similarity index 96%
rename from src/Stempler/tests/Grammar/BaseTest.php
rename to src/Stempler/tests/Grammar/BaseTestCase.php
index 127b12d85..31014bb49 100644
--- a/src/Stempler/tests/Grammar/BaseTest.php
+++ b/src/Stempler/tests/Grammar/BaseTestCase.php
@@ -8,7 +8,7 @@
use Spiral\Stempler\Lexer\Lexer;
use Spiral\Stempler\Lexer\StringStream;
-abstract class BaseTest extends TestCase
+abstract class BaseTestCase extends TestCase
{
protected const GRAMMARS = [];
diff --git a/src/Stempler/tests/Grammar/DynamicTest.php b/src/Stempler/tests/Grammar/DynamicTest.php
index 6af59fa09..b95f677b5 100644
--- a/src/Stempler/tests/Grammar/DynamicTest.php
+++ b/src/Stempler/tests/Grammar/DynamicTest.php
@@ -8,7 +8,7 @@
use Spiral\Stempler\Lexer\Grammar\DynamicGrammar;
use Spiral\Stempler\Lexer\Token;
-class DynamicTest extends BaseTest
+class DynamicTest extends BaseTestCase
{
protected const GRAMMARS = [DynamicGrammar::class];
diff --git a/src/Stempler/tests/Grammar/HTMLTest.php b/src/Stempler/tests/Grammar/HTMLTest.php
index 0ae932b05..a9a16dbe2 100644
--- a/src/Stempler/tests/Grammar/HTMLTest.php
+++ b/src/Stempler/tests/Grammar/HTMLTest.php
@@ -7,7 +7,7 @@
use Spiral\Stempler\Lexer\Grammar\HTMLGrammar;
use Spiral\Stempler\Lexer\Token;
-class HTMLTest extends BaseTest
+class HTMLTest extends BaseTestCase
{
protected const GRAMMARS = [HTMLGrammar::class];
diff --git a/src/Stempler/tests/Grammar/InlineTest.php b/src/Stempler/tests/Grammar/InlineTest.php
index 54a3b6f54..f6b5e4b02 100644
--- a/src/Stempler/tests/Grammar/InlineTest.php
+++ b/src/Stempler/tests/Grammar/InlineTest.php
@@ -7,7 +7,7 @@
use Spiral\Stempler\Lexer\Grammar\InlineGrammar;
use Spiral\Stempler\Lexer\Token;
-class InlineTest extends BaseTest
+class InlineTest extends BaseTestCase
{
protected const GRAMMARS = [InlineGrammar::class];
diff --git a/src/Stempler/tests/Grammar/MixedTest.php b/src/Stempler/tests/Grammar/MixedTest.php
index 7030b7383..52b5a7d7d 100644
--- a/src/Stempler/tests/Grammar/MixedTest.php
+++ b/src/Stempler/tests/Grammar/MixedTest.php
@@ -9,7 +9,7 @@
use Spiral\Stempler\Lexer\Grammar\PHPGrammar;
use Spiral\Stempler\Lexer\Token;
-class MixedTest extends BaseTest
+class MixedTest extends BaseTestCase
{
protected const GRAMMARS = [PHPGrammar::class, InlineGrammar::class, HTMLGrammar::class];
diff --git a/src/Stempler/tests/Grammar/PHPTest.php b/src/Stempler/tests/Grammar/PHPTest.php
index 8ae073371..7bbd6449f 100644
--- a/src/Stempler/tests/Grammar/PHPTest.php
+++ b/src/Stempler/tests/Grammar/PHPTest.php
@@ -7,7 +7,7 @@
use Spiral\Stempler\Lexer\Grammar\PHPGrammar;
use Spiral\Stempler\Lexer\Token;
-class PHPTest extends BaseTest
+class PHPTest extends BaseTestCase
{
protected const GRAMMARS = [PHPGrammar::class];
diff --git a/src/Stempler/tests/Grammar/RawTestTest.php b/src/Stempler/tests/Grammar/RawTest.php
similarity index 97%
rename from src/Stempler/tests/Grammar/RawTestTest.php
rename to src/Stempler/tests/Grammar/RawTest.php
index 630e2d7b2..3e99bd370 100644
--- a/src/Stempler/tests/Grammar/RawTestTest.php
+++ b/src/Stempler/tests/Grammar/RawTest.php
@@ -8,7 +8,7 @@
use Spiral\Stempler\Lexer\StringStream;
use Spiral\Stempler\Lexer\Token;
-class RawTest extends BaseTest
+class RawTest extends BaseTestCase
{
protected const GRAMMARS = [];
diff --git a/src/Stempler/tests/SourcemapTest.php b/src/Stempler/tests/SourcemapTest.php
index fd3b5b3e2..93a999971 100644
--- a/src/Stempler/tests/SourcemapTest.php
+++ b/src/Stempler/tests/SourcemapTest.php
@@ -7,14 +7,14 @@
use Spiral\Stempler\Builder;
use Spiral\Stempler\Directive\LoopDirective;
use Spiral\Stempler\Loader\LoaderInterface;
-use Spiral\Tests\Stempler\Transform\BaseTest;
+use Spiral\Tests\Stempler\Transform\BaseTestCase;
use Spiral\Stempler\Transform\Finalizer\DynamicToPHP;
use Spiral\Stempler\Transform\Merge\ExtendsParent;
use Spiral\Stempler\Transform\Merge\ResolveImports;
use Spiral\Stempler\Transform\Visitor\DefineAttributes;
use Spiral\Stempler\Transform\Visitor\DefineBlocks;
-class SourcemapTest extends BaseTest
+class SourcemapTest extends BaseTestCase
{
public function testSimpleLoad(): void
{
diff --git a/src/Stempler/tests/Syntax/BaseTest.php b/src/Stempler/tests/Syntax/BaseTestCase.php
similarity index 93%
rename from src/Stempler/tests/Syntax/BaseTest.php
rename to src/Stempler/tests/Syntax/BaseTestCase.php
index 43fa8952c..68708a5b7 100644
--- a/src/Stempler/tests/Syntax/BaseTest.php
+++ b/src/Stempler/tests/Syntax/BaseTestCase.php
@@ -9,7 +9,7 @@
use Spiral\Stempler\Node\Template;
use Spiral\Stempler\Parser;
-abstract class BaseTest extends TestCase
+abstract class BaseTestCase extends TestCase
{
protected const GRAMMARS = [
/* GRAMMAR => SYNTAX */
diff --git a/src/Stempler/tests/Syntax/DynamicTest.php b/src/Stempler/tests/Syntax/DynamicTest.php
index 954b74ec9..5adf534ce 100644
--- a/src/Stempler/tests/Syntax/DynamicTest.php
+++ b/src/Stempler/tests/Syntax/DynamicTest.php
@@ -10,7 +10,7 @@
use Spiral\Stempler\Node\Raw;
use Spiral\Stempler\Parser\Syntax\DynamicSyntax;
-class DynamicTest extends BaseTest
+class DynamicTest extends BaseTestCase
{
protected const GRAMMARS = [
DynamicGrammar::class => DynamicSyntax::class,
diff --git a/src/Stempler/tests/Syntax/HTMLTest.php b/src/Stempler/tests/Syntax/HTMLTest.php
index e655622c3..507f80bbd 100644
--- a/src/Stempler/tests/Syntax/HTMLTest.php
+++ b/src/Stempler/tests/Syntax/HTMLTest.php
@@ -12,7 +12,7 @@
use Spiral\Stempler\Node\Raw;
use Spiral\Stempler\Parser\Syntax\HTMLSyntax;
-class HTMLTest extends BaseTest
+class HTMLTest extends BaseTestCase
{
protected const GRAMMARS = [
HTMLGrammar::class => HTMLSyntax::class,
diff --git a/src/Stempler/tests/Syntax/InlineTest.php b/src/Stempler/tests/Syntax/InlineTest.php
index ab0fe1204..d360145ea 100644
--- a/src/Stempler/tests/Syntax/InlineTest.php
+++ b/src/Stempler/tests/Syntax/InlineTest.php
@@ -9,7 +9,7 @@
use Spiral\Stempler\Node\Raw;
use Spiral\Stempler\Parser\Syntax\InlineSyntax;
-class InlineTest extends BaseTest
+class InlineTest extends BaseTestCase
{
protected const GRAMMARS = [
InlineGrammar::class => InlineSyntax::class,
diff --git a/src/Stempler/tests/Transform/AttributesTest.php b/src/Stempler/tests/Transform/AttributesTest.php
index 4021ede3b..7c923c5d5 100644
--- a/src/Stempler/tests/Transform/AttributesTest.php
+++ b/src/Stempler/tests/Transform/AttributesTest.php
@@ -12,7 +12,7 @@
use Spiral\Stempler\Transform\Visitor\DefineAttributes;
use Spiral\Stempler\Transform\Visitor\DefineBlocks;
-class AttributesTest extends BaseTest
+class AttributesTest extends BaseTestCase
{
public function testAggregatedAttribute(): void
{
diff --git a/src/Stempler/tests/Transform/BaseTest.php b/src/Stempler/tests/Transform/BaseTestCase.php
similarity index 98%
rename from src/Stempler/tests/Transform/BaseTest.php
rename to src/Stempler/tests/Transform/BaseTestCase.php
index fbf4ac861..4fee4829e 100644
--- a/src/Stempler/tests/Transform/BaseTest.php
+++ b/src/Stempler/tests/Transform/BaseTestCase.php
@@ -23,7 +23,7 @@
use Spiral\Stempler\Parser\Syntax\InlineSyntax;
use Spiral\Stempler\Parser\Syntax\PHPSyntax;
-abstract class BaseTest extends TestCase
+abstract class BaseTestCase extends TestCase
{
protected function compile(string $source, array $visitors = [], LoaderInterface $loader = null)
{
diff --git a/src/Stempler/tests/Transform/BlocksTest.php b/src/Stempler/tests/Transform/BlocksTest.php
index 424312995..19b50addc 100644
--- a/src/Stempler/tests/Transform/BlocksTest.php
+++ b/src/Stempler/tests/Transform/BlocksTest.php
@@ -7,7 +7,7 @@
use Spiral\Stempler\Node\Block;
use Spiral\Stempler\Transform\Visitor\DefineBlocks;
-class BlocksTest extends BaseTest
+class BlocksTest extends BaseTestCase
{
public function testDefineBlock(): void
{
diff --git a/src/Stempler/tests/Transform/DynamicToPHPTest.php b/src/Stempler/tests/Transform/DynamicToPHPTest.php
index c75948764..d713b6343 100644
--- a/src/Stempler/tests/Transform/DynamicToPHPTest.php
+++ b/src/Stempler/tests/Transform/DynamicToPHPTest.php
@@ -8,7 +8,7 @@
use Spiral\Stempler\Node\PHP;
use Spiral\Stempler\Transform\Finalizer\DynamicToPHP;
-class DynamicToPHPTest extends BaseTest
+class DynamicToPHPTest extends BaseTestCase
{
public function testOutput(): void
{
diff --git a/src/Stempler/tests/Transform/ExtendsTest.php b/src/Stempler/tests/Transform/ExtendsTest.php
index c0b5774a2..97b2f7a5e 100644
--- a/src/Stempler/tests/Transform/ExtendsTest.php
+++ b/src/Stempler/tests/Transform/ExtendsTest.php
@@ -14,7 +14,7 @@
use Spiral\Stempler\Transform\Visitor\DefineAttributes;
use Spiral\Stempler\Transform\Visitor\DefineBlocks;
-class ExtendsTest extends BaseTest
+class ExtendsTest extends BaseTestCase
{
public function testNoExtends(): void
{
diff --git a/src/Stempler/tests/Transform/ImportBundleTest.php b/src/Stempler/tests/Transform/ImportBundleTest.php
index 6af74e576..1d34c0c1c 100644
--- a/src/Stempler/tests/Transform/ImportBundleTest.php
+++ b/src/Stempler/tests/Transform/ImportBundleTest.php
@@ -14,7 +14,7 @@
use Spiral\Stempler\Transform\Visitor\DefineAttributes;
use Spiral\Stempler\Transform\Visitor\DefineBlocks;
-class ImportBundleTest extends BaseTest
+class ImportBundleTest extends BaseTestCase
{
public function testNoImport(): void
{
diff --git a/src/Stempler/tests/Transform/ImportElementTest.php b/src/Stempler/tests/Transform/ImportElementTest.php
index 51b8d99b1..7d22cb244 100644
--- a/src/Stempler/tests/Transform/ImportElementTest.php
+++ b/src/Stempler/tests/Transform/ImportElementTest.php
@@ -15,7 +15,7 @@
use Spiral\Stempler\Transform\Visitor\DefineAttributes;
use Spiral\Stempler\Transform\Visitor\DefineBlocks;
-class ImportElementTest extends BaseTest
+class ImportElementTest extends BaseTestCase
{
public function testNoImport(): void
{
diff --git a/src/Stempler/tests/Transform/ImportInlineTest.php b/src/Stempler/tests/Transform/ImportInlineTest.php
index d0424a2d0..c82d1278f 100644
--- a/src/Stempler/tests/Transform/ImportInlineTest.php
+++ b/src/Stempler/tests/Transform/ImportInlineTest.php
@@ -14,7 +14,7 @@
use Spiral\Stempler\Transform\Visitor\DefineAttributes;
use Spiral\Stempler\Transform\Visitor\DefineBlocks;
-class ImportInlineTest extends BaseTest
+class ImportInlineTest extends BaseTestCase
{
public function testNoImport(): void
{
diff --git a/src/Stempler/tests/Transform/ImportedStackTest.php b/src/Stempler/tests/Transform/ImportedStackTest.php
index 5d1b10422..80e1aa10d 100644
--- a/src/Stempler/tests/Transform/ImportedStackTest.php
+++ b/src/Stempler/tests/Transform/ImportedStackTest.php
@@ -19,7 +19,7 @@
use Spiral\Stempler\Transform\Visitor\DefineHidden;
use Spiral\Stempler\Transform\Visitor\DefineStacks;
-class ImportedStackTest extends BaseTest
+class ImportedStackTest extends BaseTestCase
{
public function testEmptyStack(): void
{
diff --git a/src/Stempler/tests/Transform/StackTest.php b/src/Stempler/tests/Transform/StackTest.php
index 8833dc70d..cb49a8222 100644
--- a/src/Stempler/tests/Transform/StackTest.php
+++ b/src/Stempler/tests/Transform/StackTest.php
@@ -12,7 +12,7 @@
use Spiral\Stempler\Transform\Finalizer\TrimRaw;
use Spiral\Stempler\Transform\Visitor\DefineStacks;
-class StackTest extends BaseTest
+class StackTest extends BaseTestCase
{
public function testEmptyStack(): void
{
diff --git a/src/Stempler/tests/Transform/TrimRawTest.php b/src/Stempler/tests/Transform/TrimRawTest.php
index 5bb7e617e..673acf90d 100644
--- a/src/Stempler/tests/Transform/TrimRawTest.php
+++ b/src/Stempler/tests/Transform/TrimRawTest.php
@@ -8,7 +8,7 @@
use Spiral\Stempler\Node\Raw;
use Spiral\Stempler\Transform\Finalizer\TrimRaw;
-class TrimRawTest extends BaseTest
+class TrimRawTest extends BaseTestCase
{
public function testNotEmpty(): void
{
diff --git a/src/Stempler/tests/TraverserTest.php b/src/Stempler/tests/TraverserTest.php
index 44d361284..5dad5187d 100644
--- a/src/Stempler/tests/TraverserTest.php
+++ b/src/Stempler/tests/TraverserTest.php
@@ -11,12 +11,12 @@
use Spiral\Stempler\Node\HTML\Tag;
use Spiral\Stempler\Node\Raw;
use Spiral\Stempler\Parser\Syntax\HTMLSyntax;
-use Spiral\Tests\Stempler\Compiler\BaseTest;
+use Spiral\Tests\Stempler\Compiler\BaseTestCase;
use Spiral\Stempler\Traverser;
use Spiral\Stempler\VisitorContext;
use Spiral\Stempler\VisitorInterface;
-class TraverserTest extends BaseTest implements VisitorInterface
+class TraverserTest extends BaseTestCase implements VisitorInterface
{
protected const RENDERS = [
CoreRenderer::class,
diff --git a/src/Storage/composer.json b/src/Storage/composer.json
index 57f9fa75f..0298a459e 100644
--- a/src/Storage/composer.json
+++ b/src/Storage/composer.json
@@ -30,7 +30,7 @@
},
"require-dev": {
"spiral/boot": "^3.8",
- "phpunit/phpunit": "^9.5.20",
+ "phpunit/phpunit": "^10.1",
"vimeo/psalm": "^5.9",
"jetbrains/phpstorm-attributes": "^1.0"
},
diff --git a/src/Streams/composer.json b/src/Streams/composer.json
index 41cd35f7d..4bda81814 100644
--- a/src/Streams/composer.json
+++ b/src/Streams/composer.json
@@ -31,7 +31,7 @@
"psr/http-message": "^1.0"
},
"require-dev": {
- "phpunit/phpunit": "^9.5.20",
+ "phpunit/phpunit": "^10.1",
"mockery/mockery": "^1.5",
"spiral/files": "^3.8",
"nyholm/psr7": "^1.5",
diff --git a/src/Telemetry/composer.json b/src/Telemetry/composer.json
index 3d08f36f1..92d9219d4 100644
--- a/src/Telemetry/composer.json
+++ b/src/Telemetry/composer.json
@@ -32,7 +32,7 @@
"spiral/core": "^3.8"
},
"require-dev": {
- "phpunit/phpunit": "^9.5.20",
+ "phpunit/phpunit": "^10.1",
"vimeo/psalm": "^5.9"
},
"autoload": {
diff --git a/src/Telemetry/tests/ConfigTracerFactoryProviderTest.php b/src/Telemetry/tests/ConfigTracerFactoryProviderTest.php
index 180a108f9..94f10418f 100644
--- a/src/Telemetry/tests/ConfigTracerFactoryProviderTest.php
+++ b/src/Telemetry/tests/ConfigTracerFactoryProviderTest.php
@@ -52,7 +52,7 @@ public function testGetsTraceeFactoryWithDefaultName(): void
public function testGetsTraceeFactoryWithNonExistName(): void
{
$this->expectException(InvalidArgumentException::class);
- $this->expectErrorMessage('Config for telemetry driver `bar` is not defined.');
+ $this->expectExceptionMessage('Config for telemetry driver `bar` is not defined.');
$provider = new ConfigTracerFactoryProvider(
new TelemetryConfig([
diff --git a/src/Tokenizer/composer.json b/src/Tokenizer/composer.json
index d8c513ddc..26f32d47b 100644
--- a/src/Tokenizer/composer.json
+++ b/src/Tokenizer/composer.json
@@ -37,7 +37,7 @@
"spiral/attributes": "^2.8|^3.0",
"spiral/boot": "^3.8",
"spiral/files": "^3.8",
- "phpunit/phpunit": "^9.5.20",
+ "phpunit/phpunit": "^10.1",
"vimeo/psalm": "^5.9"
},
"autoload": {
diff --git a/src/Tokenizer/tests/Bootloader/TokenizerListenerBootloaderTest.php b/src/Tokenizer/tests/Bootloader/TokenizerListenerBootloaderTest.php
index 97f27cab9..068f731e1 100644
--- a/src/Tokenizer/tests/Bootloader/TokenizerListenerBootloaderTest.php
+++ b/src/Tokenizer/tests/Bootloader/TokenizerListenerBootloaderTest.php
@@ -5,6 +5,7 @@
namespace Spiral\Tests\Tokenizer\Bootloader;
use Mockery as m;
+use PHPUnit\Framework\Attributes\DataProvider;
use PHPUnit\Framework\TestCase;
use Spiral\Attributes\ReaderInterface;
use Spiral\Boot\DirectoriesInterface;
@@ -131,9 +132,7 @@ public function testCacheListenersWithDefaultCacheDir(): void
);
}
- /**
- * @dataProvider readCacheDataProvider
- */
+ #[DataProvider('readCacheDataProvider')]
public function testCastingReadCacheEnvVariable(mixed $readCache, bool $expected): void
{
$factory = new Container();
@@ -160,7 +159,7 @@ public function testCastingReadCacheEnvVariable(mixed $readCache, bool $expected
$this->assertSame($expected, (new \ReflectionProperty($loader, 'readCache'))->getValue($loader));
}
- public function readCacheDataProvider(): \Traversable
+ public static function readCacheDataProvider(): \Traversable
{
yield [true, true];
yield [false, false];
diff --git a/src/Tokenizer/tests/Listener/ClassLocatorByTargetTest.php b/src/Tokenizer/tests/Listener/ClassLocatorByTargetTest.php
index 0295a725c..da6d5a681 100644
--- a/src/Tokenizer/tests/Listener/ClassLocatorByTargetTest.php
+++ b/src/Tokenizer/tests/Listener/ClassLocatorByTargetTest.php
@@ -6,6 +6,7 @@
use Mockery as m;
use Mockery\Adapter\Phpunit\MockeryPHPUnitIntegration;
+use PHPUnit\Framework\Attributes\DataProvider;
use PHPUnit\Framework\TestCase;
use Spiral\Tests\Tokenizer\Classes\Listeners;
use Spiral\Tests\Tokenizer\Classes\Targets;
@@ -31,7 +32,7 @@ protected function setUp(): void
);
}
- public function provideGetClasses(): \Generator
+ public static function provideGetClasses(): \Generator
{
yield 'class' => [
Listeners\CommandInterfaceListener::class,
@@ -83,9 +84,7 @@ public function provideGetClasses(): \Generator
];
}
- /**
- * @dataProvider provideGetClasses
- */
+ #[DataProvider('provideGetClasses')]
public function testGetClasses(
string $listener,
array $expected,
diff --git a/src/Translator/composer.json b/src/Translator/composer.json
index 0e9eb685c..23c04472d 100644
--- a/src/Translator/composer.json
+++ b/src/Translator/composer.json
@@ -35,7 +35,7 @@
"psr/event-dispatcher": "^1.0"
},
"require-dev": {
- "phpunit/phpunit": "^9.5.20",
+ "phpunit/phpunit": "^10.1",
"mockery/mockery": "^1.5",
"vimeo/psalm": "^5.9"
},
diff --git a/src/Translator/tests/InterpolateTest.php b/src/Translator/tests/InterpolateTest.php
index 9bb116104..0327cddb8 100644
--- a/src/Translator/tests/InterpolateTest.php
+++ b/src/Translator/tests/InterpolateTest.php
@@ -39,7 +39,7 @@ public function testInterpolateBad(): void
{
$this->assertSame(
'Bye, {1}!',
- $this->translator()->trans('Bye, {1}!', [new self()])
+ $this->translator()->trans('Bye, {1}!', [new self('foo')])
);
}
diff --git a/src/Translator/tests/MatcherTest.php b/src/Translator/tests/MatcherTest.php
index 6e33585cc..46c9b2a35 100644
--- a/src/Translator/tests/MatcherTest.php
+++ b/src/Translator/tests/MatcherTest.php
@@ -4,10 +4,11 @@
namespace Spiral\Tests\Translator;
+use PHPUnit\Framework\Attributes\DataProvider;
use PHPUnit\Framework\TestCase;
use Spiral\Translator\Matcher;
-class PatternizerTest extends TestCase
+class MatcherTest extends TestCase
{
public function testIsPattern(): void
{
@@ -17,33 +18,22 @@ public function testIsPattern(): void
$this->assertTrue($patternizer->isPattern('ab(d|e)'));
}
- /**
- * @dataProvider patternProvider
- *
- * @param array $string
- * @param array $pattern
- * @param bool $result
- */
- public function testMatch($string, $pattern, $result): void
+ #[DataProvider('patternProvider')]
+ public function testMatch(string $string, string $pattern, bool $result): void
{
$matcher = new Matcher();
$this->assertEquals($result, $matcher->matches($string, $pattern));
}
- /**
- * @return array
- */
- public function patternProvider()
+ public static function patternProvider(): \Traversable
{
- return [
- ['string', 'string', true],
- ['string', 'st*', true],
- ['abc', 'dce', false],
- ['abc', 'a(bc|de)', true],
- ['ade', 'a(bc|de)', true],
- ['string', '*ring', true],
- ['ring', '*ring', false],
- ['strings', '*ri(ng|ngs)', true],
- ];
+ yield ['string', 'string', true];
+ yield ['string', 'st*', true];
+ yield ['abc', 'dce', false];
+ yield ['abc', 'a(bc|de)', true];
+ yield ['ade', 'a(bc|de)', true];
+ yield ['string', '*ring', true];
+ yield ['ring', '*ring', false];
+ yield ['strings', '*ri(ng|ngs)', true];
}
}
diff --git a/src/Validation/composer.json b/src/Validation/composer.json
index ab43edcad..e387cb9a4 100644
--- a/src/Validation/composer.json
+++ b/src/Validation/composer.json
@@ -32,7 +32,7 @@
},
"require-dev": {
"spiral/boot": "^3.8",
- "phpunit/phpunit": "^9.5.20",
+ "phpunit/phpunit": "^10.1",
"mockery/mockery": "^1.5",
"vimeo/psalm": "^5.9"
},
diff --git a/src/Views/composer.json b/src/Views/composer.json
index 9313b023a..b7e6f857a 100644
--- a/src/Views/composer.json
+++ b/src/Views/composer.json
@@ -34,7 +34,7 @@
},
"require-dev": {
"spiral/boot": "^3.8",
- "phpunit/phpunit": "^9.5.20",
+ "phpunit/phpunit": "^10.1",
"mockery/mockery": "^1.5",
"vimeo/psalm": "^5.9"
},
diff --git a/tests/Framework/Auth/AuthConfigTest.php b/tests/Framework/Auth/AuthConfigTest.php
index e3f0a4331..2b7eaed0d 100644
--- a/tests/Framework/Auth/AuthConfigTest.php
+++ b/tests/Framework/Auth/AuthConfigTest.php
@@ -4,10 +4,10 @@
use Spiral\Auth\Config\AuthConfig;
use Spiral\Auth\TokenStorageInterface as SessionTokenStorageInterface;
-use Spiral\Tests\Framework\BaseTest;
+use Spiral\Tests\Framework\BaseTestCase;
use Mockery as m;
-class AuthConfigTest extends BaseTest
+class AuthConfigTest extends BaseTestCase
{
public function testGetStorage(): void
{
diff --git a/tests/Framework/BaseTest.php b/tests/Framework/BaseTestCase.php
similarity index 90%
rename from tests/Framework/BaseTest.php
rename to tests/Framework/BaseTestCase.php
index a634993cd..500e20613 100644
--- a/tests/Framework/BaseTest.php
+++ b/tests/Framework/BaseTestCase.php
@@ -7,7 +7,7 @@
use Spiral\App\TestApp;
use Spiral\Core\Container;
-abstract class BaseTest extends \Spiral\Testing\TestCase
+abstract class BaseTestCase extends \Spiral\Testing\TestCase
{
public function rootDirectory(): string
{
diff --git a/tests/Framework/Bootloader/Auth/AuthBootloaderTest.php b/tests/Framework/Bootloader/Auth/AuthBootloaderTest.php
index a1d84de68..da6d28833 100644
--- a/tests/Framework/Bootloader/Auth/AuthBootloaderTest.php
+++ b/tests/Framework/Bootloader/Auth/AuthBootloaderTest.php
@@ -6,9 +6,9 @@
use Spiral\Auth\ActorProviderInterface;
use Spiral\Auth\AuthScope;
-use Spiral\Tests\Framework\BaseTest;
+use Spiral\Tests\Framework\BaseTestCase;
-final class AuthBootloaderTest extends BaseTest
+final class AuthBootloaderTest extends BaseTestCase
{
public function testAuthScopeBinding(): void
{
diff --git a/tests/Framework/Bootloader/Boot/ConfigurationBootloaderTest.php b/tests/Framework/Bootloader/Boot/ConfigurationBootloaderTest.php
index a0f4636d8..5459585b6 100644
--- a/tests/Framework/Bootloader/Boot/ConfigurationBootloaderTest.php
+++ b/tests/Framework/Bootloader/Boot/ConfigurationBootloaderTest.php
@@ -7,9 +7,9 @@
use Spiral\Config\ConfigManager;
use Spiral\Config\ConfiguratorInterface;
use Spiral\Core\ConfigsInterface;
-use Spiral\Tests\Framework\BaseTest;
+use Spiral\Tests\Framework\BaseTestCase;
-final class ConfigurationBootloaderTest extends BaseTest
+final class ConfigurationBootloaderTest extends BaseTestCase
{
public function testConfigsInterfaceBinding(): void
{
diff --git a/tests/Framework/Bootloader/Boot/CoreBootloaderTest.php b/tests/Framework/Bootloader/Boot/CoreBootloaderTest.php
index dfbb471aa..35df055f1 100644
--- a/tests/Framework/Bootloader/Boot/CoreBootloaderTest.php
+++ b/tests/Framework/Bootloader/Boot/CoreBootloaderTest.php
@@ -12,9 +12,9 @@
use Spiral\Logger\ListenerRegistryInterface;
use Spiral\Logger\LogFactory;
use Spiral\Logger\LogsInterface;
-use Spiral\Tests\Framework\BaseTest;
+use Spiral\Tests\Framework\BaseTestCase;
-final class CoreBootloaderTest extends BaseTest
+final class CoreBootloaderTest extends BaseTestCase
{
public function testFilesInterfaceBinding(): void
{
diff --git a/tests/Framework/Bootloader/Broadcasting/BroadcastingBootloaderTest.php b/tests/Framework/Bootloader/Broadcasting/BroadcastingBootloaderTest.php
index 64c96a303..2a4495f7a 100644
--- a/tests/Framework/Bootloader/Broadcasting/BroadcastingBootloaderTest.php
+++ b/tests/Framework/Bootloader/Broadcasting/BroadcastingBootloaderTest.php
@@ -14,9 +14,9 @@
use Spiral\Broadcasting\TopicRegistryInterface;
use Spiral\Config\ConfigManager;
use Spiral\Config\LoaderInterface;
-use Spiral\Tests\Framework\BaseTest;
+use Spiral\Tests\Framework\BaseTestCase;
-final class BroadcastingBootloaderTest extends BaseTest
+final class BroadcastingBootloaderTest extends BaseTestCase
{
public const ENV = [
'BROADCAST_CONNECTION' => 'null',
diff --git a/tests/Framework/Bootloader/Broadcasting/WebsocketsBootloaderTest.php b/tests/Framework/Bootloader/Broadcasting/WebsocketsBootloaderTest.php
index 55b80931e..bf365e9ff 100644
--- a/tests/Framework/Bootloader/Broadcasting/WebsocketsBootloaderTest.php
+++ b/tests/Framework/Bootloader/Broadcasting/WebsocketsBootloaderTest.php
@@ -5,9 +5,9 @@
namespace Framework\Bootloader\Broadcasting;
use Spiral\Broadcasting\Middleware\AuthorizationMiddleware;
-use Spiral\Tests\Framework\BaseTest;
+use Spiral\Tests\Framework\BaseTestCase;
-final class WebsocketsBootloaderTest extends BaseTest
+final class WebsocketsBootloaderTest extends BaseTestCase
{
public function testAuthorizationMiddlewareBinding(): void
{
diff --git a/tests/Framework/Bootloader/Cache/CacheBootloaderTest.php b/tests/Framework/Bootloader/Cache/CacheBootloaderTest.php
index 6dfeb04e5..a31bbb99f 100644
--- a/tests/Framework/Bootloader/Cache/CacheBootloaderTest.php
+++ b/tests/Framework/Bootloader/Cache/CacheBootloaderTest.php
@@ -14,9 +14,9 @@
use Spiral\Cache\Storage\FileStorage;
use Spiral\Config\ConfigManager;
use Spiral\Config\LoaderInterface;
-use Spiral\Tests\Framework\BaseTest;
+use Spiral\Tests\Framework\BaseTestCase;
-final class CacheBootloaderTest extends BaseTest
+final class CacheBootloaderTest extends BaseTestCase
{
public function testBindings()
{
diff --git a/tests/Framework/Bootloader/Console/ConsoleBootloaderTest.php b/tests/Framework/Bootloader/Console/ConsoleBootloaderTest.php
index 427e9427e..877bbeef1 100644
--- a/tests/Framework/Bootloader/Console/ConsoleBootloaderTest.php
+++ b/tests/Framework/Bootloader/Console/ConsoleBootloaderTest.php
@@ -13,10 +13,10 @@
use Spiral\Console\ConsoleDispatcher;
use Spiral\Console\LocatorInterface;
use Spiral\Console\Sequence\CommandSequence;
-use Spiral\Tests\Framework\BaseTest;
+use Spiral\Tests\Framework\BaseTestCase;
use Symfony\Component\Console\Output\BufferedOutput;
-final class ConsoleBootloaderTest extends BaseTest
+final class ConsoleBootloaderTest extends BaseTestCase
{
public function testConsoleBinding(): void
{
diff --git a/tests/Framework/Bootloader/Debug/DebugBootloaderTest.php b/tests/Framework/Bootloader/Debug/DebugBootloaderTest.php
index f9f2d6444..967569202 100644
--- a/tests/Framework/Bootloader/Debug/DebugBootloaderTest.php
+++ b/tests/Framework/Bootloader/Debug/DebugBootloaderTest.php
@@ -7,9 +7,9 @@
use Spiral\Debug\State;
use Spiral\Debug\StateCollector\EnvironmentCollector;
use Spiral\Debug\StateInterface;
-use Spiral\Tests\Framework\BaseTest;
+use Spiral\Tests\Framework\BaseTestCase;
-final class DebugBootloaderTest extends BaseTest
+final class DebugBootloaderTest extends BaseTestCase
{
public function testEnvironmentCollectorBinding(): void
{
diff --git a/tests/Framework/Bootloader/Distribution/DistributionBootloaderTest.php b/tests/Framework/Bootloader/Distribution/DistributionBootloaderTest.php
index 22e88a534..a16d9fcc0 100644
--- a/tests/Framework/Bootloader/Distribution/DistributionBootloaderTest.php
+++ b/tests/Framework/Bootloader/Distribution/DistributionBootloaderTest.php
@@ -10,9 +10,9 @@
use Spiral\Distribution\Manager;
use Spiral\Distribution\MutableDistributionInterface;
use Spiral\Distribution\UriResolverInterface;
-use Spiral\Tests\Framework\BaseTest;
+use Spiral\Tests\Framework\BaseTestCase;
-final class DistributionBootloaderTest extends BaseTest
+final class DistributionBootloaderTest extends BaseTestCase
{
public function testUriResolverInterfaceBinding(): void
{
diff --git a/tests/Framework/Bootloader/DomainBootloaderTest.php b/tests/Framework/Bootloader/DomainBootloaderTest.php
index 7e36b7b96..334e205b9 100644
--- a/tests/Framework/Bootloader/DomainBootloaderTest.php
+++ b/tests/Framework/Bootloader/DomainBootloaderTest.php
@@ -11,9 +11,9 @@
use Spiral\Core\Container\Autowire;
use Spiral\Core\Core;
use Spiral\Core\InterceptableCore;
-use Spiral\Tests\Framework\BaseTest;
+use Spiral\Tests\Framework\BaseTestCase;
-final class DomainBootloaderTest extends BaseTest
+final class DomainBootloaderTest extends BaseTestCase
{
public function testDefineInterceptors(): void
{
diff --git a/tests/Framework/Bootloader/Events/EventsBootloaderTest.php b/tests/Framework/Bootloader/Events/EventsBootloaderTest.php
index 3713eb1a4..0c77a1bd8 100644
--- a/tests/Framework/Bootloader/Events/EventsBootloaderTest.php
+++ b/tests/Framework/Bootloader/Events/EventsBootloaderTest.php
@@ -21,9 +21,9 @@
use Spiral\Events\ListenerFactoryInterface;
use Spiral\Events\ListenerProcessorRegistry;
use Spiral\Events\Processor\ProcessorInterface;
-use Spiral\Tests\Framework\BaseTest;
+use Spiral\Tests\Framework\BaseTestCase;
-final class EventsBootloaderTest extends BaseTest
+final class EventsBootloaderTest extends BaseTestCase
{
public function testListenerFactoryInterfaceBinding(): void
{
diff --git a/tests/Framework/Bootloader/Exceptions/SnapshotsBootloaderTest.php b/tests/Framework/Bootloader/Exceptions/SnapshotsBootloaderTest.php
index 07bf5c556..4f140bdd5 100644
--- a/tests/Framework/Bootloader/Exceptions/SnapshotsBootloaderTest.php
+++ b/tests/Framework/Bootloader/Exceptions/SnapshotsBootloaderTest.php
@@ -7,9 +7,9 @@
use Spiral\Snapshots\FileSnapshooter;
use Spiral\Snapshots\FileSnapshot;
use Spiral\Snapshots\SnapshotterInterface;
-use Spiral\Tests\Framework\BaseTest;
+use Spiral\Tests\Framework\BaseTestCase;
-final class SnapshotsBootloaderTest extends BaseTest
+final class SnapshotsBootloaderTest extends BaseTestCase
{
public function testSnapshotterInterfaceBinding(): void
{
diff --git a/tests/Framework/Bootloader/Http/CookiesBootloaderTest.php b/tests/Framework/Bootloader/Http/CookiesBootloaderTest.php
index 1d1308250..0754a2142 100644
--- a/tests/Framework/Bootloader/Http/CookiesBootloaderTest.php
+++ b/tests/Framework/Bootloader/Http/CookiesBootloaderTest.php
@@ -10,9 +10,9 @@
use Spiral\Config\LoaderInterface;
use Spiral\Cookies\Config\CookiesConfig;
use Spiral\Cookies\CookieQueue;
-use Spiral\Tests\Framework\BaseTest;
+use Spiral\Tests\Framework\BaseTestCase;
-final class CookiesBootloaderTest extends BaseTest
+final class CookiesBootloaderTest extends BaseTestCase
{
public function testCookieQueueBinding(): void
{
@@ -27,7 +27,7 @@ public function testCookieQueueBinding(): void
public function testCookieQueueBindingShouldThrowAndExceptionWhenAttributeIsEmpty(): void
{
- $this->expectErrorMessage('Unable to resolve CookieQueue, invalid request scope');
+ $this->expectExceptionMessage('Unable to resolve CookieQueue, invalid request scope');
$request = $this->mockContainer(ServerRequestInterface::class);
$request->shouldReceive('getAttribute')
->once()
diff --git a/tests/Framework/Bootloader/Http/HttpAuthBootloaderTest.php b/tests/Framework/Bootloader/Http/HttpAuthBootloaderTest.php
index 71e8fe241..cbd1e86b0 100644
--- a/tests/Framework/Bootloader/Http/HttpAuthBootloaderTest.php
+++ b/tests/Framework/Bootloader/Http/HttpAuthBootloaderTest.php
@@ -13,9 +13,9 @@
use Spiral\Bootloader\Auth\HttpAuthBootloader;
use Spiral\Config\LoaderInterface;
use Spiral\Config\ConfigManager;
-use Spiral\Tests\Framework\BaseTest;
+use Spiral\Tests\Framework\BaseTestCase;
-final class HttpAuthBootloaderTest extends BaseTest
+final class HttpAuthBootloaderTest extends BaseTestCase
{
public function testTokenStorageProviderInterfaceBinding(): void
{
diff --git a/tests/Framework/Bootloader/Http/HttpBootloaderTest.php b/tests/Framework/Bootloader/Http/HttpBootloaderTest.php
index 57b83fd39..7ffd62396 100644
--- a/tests/Framework/Bootloader/Http/HttpBootloaderTest.php
+++ b/tests/Framework/Bootloader/Http/HttpBootloaderTest.php
@@ -4,6 +4,7 @@
namespace Spiral\Tests\Framework\Bootloader\Http;
+use PHPUnit\Framework\Attributes\DataProvider;
use Psr\Http\Message\ResponseInterface;
use Psr\Http\Message\ServerRequestInterface;
use Psr\Http\Server\MiddlewareInterface;
@@ -14,9 +15,9 @@
use Spiral\Core\Container\Autowire;
use Spiral\Http\Config\HttpConfig;
use Spiral\Http\Http;
-use Spiral\Tests\Framework\BaseTest;
+use Spiral\Tests\Framework\BaseTestCase;
-final class HttpBootloaderTest extends BaseTest
+final class HttpBootloaderTest extends BaseTestCase
{
public function testHttpBinding(): void
{
@@ -41,7 +42,7 @@ public function testAddInputBag(): void
], $configs->getConfig(HttpConfig::CONFIG)['inputBags']);
}
- /** @dataProvider middlewaresDataProvider */
+ #[DataProvider('middlewaresDataProvider')]
public function testAddMiddleware(mixed $middleware): void
{
$configs = new ConfigManager($this->createMock(LoaderInterface::class));
@@ -53,7 +54,7 @@ public function testAddMiddleware(mixed $middleware): void
$this->assertSame([$middleware], $configs->getConfig(HttpConfig::CONFIG)['middleware']);
}
- public function middlewaresDataProvider(): \Traversable
+ public static function middlewaresDataProvider(): \Traversable
{
yield ['class-string'];
yield [new class () implements MiddlewareInterface
diff --git a/tests/Framework/Bootloader/Http/JsonPayloadsBootloaderTest.php b/tests/Framework/Bootloader/Http/JsonPayloadsBootloaderTest.php
index 5abe43b93..0e4856be7 100644
--- a/tests/Framework/Bootloader/Http/JsonPayloadsBootloaderTest.php
+++ b/tests/Framework/Bootloader/Http/JsonPayloadsBootloaderTest.php
@@ -8,9 +8,9 @@
use Spiral\Bootloader\Http\JsonPayloadsBootloader;
use Spiral\Config\ConfigManager;
use Spiral\Config\LoaderInterface;
-use Spiral\Tests\Framework\BaseTest;
+use Spiral\Tests\Framework\BaseTestCase;
-final class JsonPayloadsBootloaderTest extends BaseTest
+final class JsonPayloadsBootloaderTest extends BaseTestCase
{
public function testConfig(): void
{
diff --git a/tests/Framework/Bootloader/Http/PaginationBootloaderTest.php b/tests/Framework/Bootloader/Http/PaginationBootloaderTest.php
index 0f9353d7d..a3b51f2d2 100644
--- a/tests/Framework/Bootloader/Http/PaginationBootloaderTest.php
+++ b/tests/Framework/Bootloader/Http/PaginationBootloaderTest.php
@@ -6,9 +6,9 @@
use Spiral\Http\PaginationFactory;
use Spiral\Pagination\PaginationProviderInterface;
-use Spiral\Tests\Framework\BaseTest;
+use Spiral\Tests\Framework\BaseTestCase;
-final class PaginationBootloaderTest extends BaseTest
+final class PaginationBootloaderTest extends BaseTestCase
{
public function testPaginationProviderInterfaceBinding(): void
{
diff --git a/tests/Framework/Bootloader/Http/SessionBootloaderTest.php b/tests/Framework/Bootloader/Http/SessionBootloaderTest.php
index f535e9849..1630fb8e0 100644
--- a/tests/Framework/Bootloader/Http/SessionBootloaderTest.php
+++ b/tests/Framework/Bootloader/Http/SessionBootloaderTest.php
@@ -6,9 +6,9 @@
use Spiral\Session\SessionFactory;
use Spiral\Session\SessionFactoryInterface;
-use Spiral\Tests\Framework\BaseTest;
+use Spiral\Tests\Framework\BaseTestCase;
-final class SessionBootloaderTest extends BaseTest
+final class SessionBootloaderTest extends BaseTestCase
{
public function testSessionFactoryInterfaceBinding(): void
{
diff --git a/tests/Framework/Bootloader/Prototype/PrototypeBootloaderTest.php b/tests/Framework/Bootloader/Prototype/PrototypeBootloaderTest.php
index ba0c62ae9..9191fd95f 100644
--- a/tests/Framework/Bootloader/Prototype/PrototypeBootloaderTest.php
+++ b/tests/Framework/Bootloader/Prototype/PrototypeBootloaderTest.php
@@ -10,10 +10,10 @@
use Spiral\Bootloader\Attributes\AttributesBootloader;
use Spiral\Prototype\Bootloader\PrototypeBootloader;
use Spiral\Prototype\PrototypeRegistry;
-use Spiral\Tests\Framework\BaseTest;
+use Spiral\Tests\Framework\BaseTestCase;
use Spiral\Tokenizer\Bootloader\TokenizerListenerBootloader;
-final class PrototypeBootloaderTest extends BaseTest
+final class PrototypeBootloaderTest extends BaseTestCase
{
protected function setUp(): void
{
diff --git a/tests/Framework/Bootloader/Queue/QueueBootloaderTest.php b/tests/Framework/Bootloader/Queue/QueueBootloaderTest.php
index af8cbfe8c..11c1c1dc5 100644
--- a/tests/Framework/Bootloader/Queue/QueueBootloaderTest.php
+++ b/tests/Framework/Bootloader/Queue/QueueBootloaderTest.php
@@ -18,9 +18,9 @@
use Spiral\Queue\QueueInterface;
use Spiral\Queue\QueueManager;
use Spiral\Queue\QueueRegistry;
-use Spiral\Tests\Framework\BaseTest;
+use Spiral\Tests\Framework\BaseTestCase;
-final class QueueBootloaderTest extends BaseTest
+final class QueueBootloaderTest extends BaseTestCase
{
public const ENV = [
'QUEUE_CONNECTION' => 'foo',
diff --git a/tests/Framework/Bootloader/Router/RouterBootloaderTest.php b/tests/Framework/Bootloader/Router/RouterBootloaderTest.php
index edad796c2..2d31be257 100644
--- a/tests/Framework/Bootloader/Router/RouterBootloaderTest.php
+++ b/tests/Framework/Bootloader/Router/RouterBootloaderTest.php
@@ -18,9 +18,9 @@
use Spiral\Router\RouteInterface;
use Spiral\Router\Router;
use Spiral\Router\RouterInterface;
-use Spiral\Tests\Framework\BaseTest;
+use Spiral\Tests\Framework\BaseTestCase;
-final class RouterBootloaderTest extends BaseTest
+final class RouterBootloaderTest extends BaseTestCase
{
public function testCoreInterfaceBinding(): void
{
@@ -75,7 +75,7 @@ public function testRouteInterfaceBinding(): void
public function testRouteInterfaceShouldThrowAnExceptionWhenRequestDoesNotContainIt(): void
{
- $this->expectErrorMessage('Unable to resolve Route, invalid request scope');
+ $this->expectExceptionMessage('Unable to resolve Route, invalid request scope');
$request = $this->mockContainer(ServerRequestInterface::class);
$request->shouldReceive('getAttribute')
diff --git a/tests/Framework/Bootloader/Scaffolder/ScaffolderBootloaderTest.php b/tests/Framework/Bootloader/Scaffolder/ScaffolderBootloaderTest.php
index d86fe1816..da1ee147a 100644
--- a/tests/Framework/Bootloader/Scaffolder/ScaffolderBootloaderTest.php
+++ b/tests/Framework/Bootloader/Scaffolder/ScaffolderBootloaderTest.php
@@ -13,9 +13,9 @@
use Spiral\Scaffolder\Bootloader\ScaffolderBootloader;
use Spiral\Scaffolder\Declaration;
use Spiral\Scaffolder\Config\ScaffolderConfig;
-use Spiral\Tests\Framework\BaseTest;
+use Spiral\Tests\Framework\BaseTestCase;
-final class ScaffolderBootloaderTest extends BaseTest
+final class ScaffolderBootloaderTest extends BaseTestCase
{
public function testSlugifyInterfaceBinding(): void
{
diff --git a/tests/Framework/Bootloader/Security/EncrypterBootloaderTest.php b/tests/Framework/Bootloader/Security/EncrypterBootloaderTest.php
index 129f2c6c6..8673e381d 100644
--- a/tests/Framework/Bootloader/Security/EncrypterBootloaderTest.php
+++ b/tests/Framework/Bootloader/Security/EncrypterBootloaderTest.php
@@ -9,9 +9,9 @@
use Spiral\Encrypter\EncrypterFactory;
use Spiral\Encrypter\EncrypterInterface;
use Spiral\Encrypter\EncryptionInterface;
-use Spiral\Tests\Framework\BaseTest;
+use Spiral\Tests\Framework\BaseTestCase;
-final class EncrypterBootloaderTest extends BaseTest
+final class EncrypterBootloaderTest extends BaseTestCase
{
public const ENV = [
'ENCRYPTER_KEY' => 'def000004894d79b1669d0c254164b501a1894bec1a65c4486af413d741e1c3d07fba4124a6c3b9f9a4a5253f667f1494a62c5976e0628de4f31f62651108e7b0c42fe1c',
diff --git a/tests/Framework/Bootloader/Security/FiltersBootloaderTest.php b/tests/Framework/Bootloader/Security/FiltersBootloaderTest.php
index c6a27a1a2..fb9d1f3d7 100644
--- a/tests/Framework/Bootloader/Security/FiltersBootloaderTest.php
+++ b/tests/Framework/Bootloader/Security/FiltersBootloaderTest.php
@@ -15,9 +15,9 @@
use Spiral\Filters\Model\Interceptor\PopulateDataFromEntityInterceptor;
use Spiral\Filters\Model\Interceptor\ValidateFilterInterceptor;
use Spiral\Filters\InputInterface;
-use Spiral\Tests\Framework\BaseTest;
+use Spiral\Tests\Framework\BaseTestCase;
-final class FiltersBootloaderTest extends BaseTest
+final class FiltersBootloaderTest extends BaseTestCase
{
public function testFilterProviderInterfaceBinding(): void
{
diff --git a/tests/Framework/Bootloader/Security/GuardBootloaderTest.php b/tests/Framework/Bootloader/Security/GuardBootloaderTest.php
index 49cb1b6f7..f0ef51a55 100644
--- a/tests/Framework/Bootloader/Security/GuardBootloaderTest.php
+++ b/tests/Framework/Bootloader/Security/GuardBootloaderTest.php
@@ -14,9 +14,9 @@
use Spiral\Security\PermissionsInterface;
use Spiral\Security\RuleManager;
use Spiral\Security\RulesInterface;
-use Spiral\Tests\Framework\BaseTest;
+use Spiral\Tests\Framework\BaseTestCase;
-final class GuardBootloaderTest extends BaseTest
+final class GuardBootloaderTest extends BaseTestCase
{
public function testPermissionsInterfaceBinding(): void
{
diff --git a/tests/Framework/Bootloader/SendIt/MailerBootloaderTest.php b/tests/Framework/Bootloader/SendIt/MailerBootloaderTest.php
index 0d39a0a77..1709e04d3 100644
--- a/tests/Framework/Bootloader/SendIt/MailerBootloaderTest.php
+++ b/tests/Framework/Bootloader/SendIt/MailerBootloaderTest.php
@@ -12,13 +12,13 @@
use Spiral\SendIt\TransportRegistryInterface;
use Spiral\SendIt\TransportResolver;
use Spiral\SendIt\TransportResolverInterface;
-use Spiral\Tests\Framework\BaseTest;
+use Spiral\Tests\Framework\BaseTestCase;
use Symfony\Component\Mailer\Mailer;
use Symfony\Component\Mailer\MailerInterface as SymfonyMailer;
use Symfony\Component\Mailer\Transport\Smtp\SmtpTransport;
use Symfony\Component\Mailer\Transport\TransportInterface;
-final class MailerBootloaderTest extends BaseTest
+final class MailerBootloaderTest extends BaseTestCase
{
public const ENV = [
'MAILER_DSN' => 'smtp://user:pass@smtp.example.com:25',
diff --git a/tests/Framework/Bootloader/Serializer/SerializerBootloaderTest.php b/tests/Framework/Bootloader/Serializer/SerializerBootloaderTest.php
index 2c56b3b69..92ac55f01 100644
--- a/tests/Framework/Bootloader/Serializer/SerializerBootloaderTest.php
+++ b/tests/Framework/Bootloader/Serializer/SerializerBootloaderTest.php
@@ -9,9 +9,9 @@
use Spiral\Serializer\SerializerManager;
use Spiral\Serializer\SerializerRegistry;
use Spiral\Serializer\SerializerRegistryInterface;
-use Spiral\Tests\Framework\BaseTest;
+use Spiral\Tests\Framework\BaseTestCase;
-final class SerializerBootloaderTest extends BaseTest
+final class SerializerBootloaderTest extends BaseTestCase
{
public const ENV = [
'DEFAULT_SERIALIZER_FORMAT' => 'test',
diff --git a/tests/Framework/Bootloader/Storage/StorageBootloaderTest.php b/tests/Framework/Bootloader/Storage/StorageBootloaderTest.php
index be16beefb..07085d5ff 100644
--- a/tests/Framework/Bootloader/Storage/StorageBootloaderTest.php
+++ b/tests/Framework/Bootloader/Storage/StorageBootloaderTest.php
@@ -15,9 +15,9 @@
use Spiral\Storage\Config\StorageConfig;
use Spiral\Storage\Storage;
use Spiral\Storage\StorageInterface;
-use Spiral\Tests\Framework\BaseTest;
+use Spiral\Tests\Framework\BaseTestCase;
-final class StorageBootloaderTest extends BaseTest
+final class StorageBootloaderTest extends BaseTestCase
{
public const ENV = ['STORAGE_DEFAULT' => 'foo'];
diff --git a/tests/Framework/Bootloader/Telemetry/TelemetryBootloaderTest.php b/tests/Framework/Bootloader/Telemetry/TelemetryBootloaderTest.php
index 77b4224b8..67e0ff29b 100644
--- a/tests/Framework/Bootloader/Telemetry/TelemetryBootloaderTest.php
+++ b/tests/Framework/Bootloader/Telemetry/TelemetryBootloaderTest.php
@@ -19,9 +19,9 @@
use Spiral\Telemetry\TracerFactoryInterface;
use Spiral\Telemetry\TracerInterface;
use Spiral\Telemetry\TracerFactoryProviderInterface;
-use Spiral\Tests\Framework\BaseTest;
+use Spiral\Tests\Framework\BaseTestCase;
-final class TelemetryBootloaderTest extends BaseTest
+final class TelemetryBootloaderTest extends BaseTestCase
{
public function testTracerFactoryInterfaceBinding(): void
{
diff --git a/tests/Framework/Bootloader/Tokenizer/TokenizerBootloaderTest.php b/tests/Framework/Bootloader/Tokenizer/TokenizerBootloaderTest.php
index 586ed40f7..99d6f46bb 100644
--- a/tests/Framework/Bootloader/Tokenizer/TokenizerBootloaderTest.php
+++ b/tests/Framework/Bootloader/Tokenizer/TokenizerBootloaderTest.php
@@ -6,7 +6,7 @@
use Spiral\Config\ConfigManager;
use Spiral\Config\LoaderInterface;
-use Spiral\Tests\Framework\BaseTest;
+use Spiral\Tests\Framework\BaseTestCase;
use Spiral\Tokenizer\Bootloader\TokenizerBootloader;
use Spiral\Tokenizer\ClassesInterface;
use Spiral\Tokenizer\ClassLocator;
@@ -16,7 +16,7 @@
use Spiral\Tokenizer\ScopedClassesInterface;
use Spiral\Tokenizer\ScopedClassLocator;
-final class TokenizerBootloaderTest extends BaseTest
+final class TokenizerBootloaderTest extends BaseTestCase
{
public function testScopedClassesInterfaceBinding(): void
{
diff --git a/tests/Framework/Bootloader/Tokenizer/TokenizerListenerBootloaderTest.php b/tests/Framework/Bootloader/Tokenizer/TokenizerListenerBootloaderTest.php
index c57697066..2b8d96d3a 100644
--- a/tests/Framework/Bootloader/Tokenizer/TokenizerListenerBootloaderTest.php
+++ b/tests/Framework/Bootloader/Tokenizer/TokenizerListenerBootloaderTest.php
@@ -5,7 +5,7 @@
namespace Framework\Bootloader\Tokenizer;
use Spiral\App\Tokenizer\TestInterface;
-use Spiral\Tests\Framework\BaseTest;
+use Spiral\Tests\Framework\BaseTestCase;
use Spiral\Tokenizer\Bootloader\TokenizerBootloader;
use Spiral\Tokenizer\Bootloader\TokenizerListenerBootloader;
use Spiral\Tokenizer\Listener\CachedClassesLoader;
@@ -13,7 +13,7 @@
use Spiral\Tokenizer\TokenizationListenerInterface;
use Spiral\Tokenizer\TokenizerListenerRegistryInterface;
-final class TokenizerListenerBootloaderTest extends BaseTest
+final class TokenizerListenerBootloaderTest extends BaseTestCase
{
protected array $classes = [];
protected bool $finalized = false;
diff --git a/tests/Framework/Bootloader/Translation/I18nBootloaderTest.php b/tests/Framework/Bootloader/Translation/I18nBootloaderTest.php
index 48dced585..5e0c29731 100644
--- a/tests/Framework/Bootloader/Translation/I18nBootloaderTest.php
+++ b/tests/Framework/Bootloader/Translation/I18nBootloaderTest.php
@@ -4,7 +4,7 @@
namespace Framework\Bootloader\Translation;
-use Spiral\Tests\Framework\BaseTest;
+use Spiral\Tests\Framework\BaseTestCase;
use Spiral\Translator\Catalogue\CacheInterface;
use Spiral\Translator\Catalogue\CatalogueLoader;
use Spiral\Translator\Catalogue\CatalogueManager;
@@ -15,7 +15,7 @@
use Spiral\Translator\TranslatorInterface;
use Symfony\Component\Translation\IdentityTranslator;
-class I18nBootloaderTest extends BaseTest
+class I18nBootloaderTest extends BaseTestCase
{
public function testTranslatorInterfaceBinding(): void
{
diff --git a/tests/Framework/Bootloader/Validation/ValidationBootloaderTest.php b/tests/Framework/Bootloader/Validation/ValidationBootloaderTest.php
index 78ee4ea93..d7da7f83a 100644
--- a/tests/Framework/Bootloader/Validation/ValidationBootloaderTest.php
+++ b/tests/Framework/Bootloader/Validation/ValidationBootloaderTest.php
@@ -6,7 +6,7 @@
use Spiral\Config\ConfiguratorInterface;
use Spiral\Config\Patch\Set;
-use Spiral\Tests\Framework\BaseTest;
+use Spiral\Tests\Framework\BaseTestCase;
use Spiral\Validation\Bootloader\ValidationBootloader;
use Spiral\Validation\Config\ValidationConfig;
use Spiral\Validation\Exception\ValidationException;
@@ -15,7 +15,7 @@
use Spiral\Validation\ValidationProviderInterface;
use Spiral\Validation\ValidatorInterface;
-final class ValidationBootloaderTest extends BaseTest
+final class ValidationBootloaderTest extends BaseTestCase
{
public function testValidationProviderInterfaceBinding(): void
{
diff --git a/tests/Framework/Bootloader/Views/ViewsBootloaderTest.php b/tests/Framework/Bootloader/Views/ViewsBootloaderTest.php
index c43befd72..b753c7c28 100644
--- a/tests/Framework/Bootloader/Views/ViewsBootloaderTest.php
+++ b/tests/Framework/Bootloader/Views/ViewsBootloaderTest.php
@@ -5,7 +5,7 @@
namespace Framework\Bootloader\Views;
use Spiral\Config\ConfigManager;
-use Spiral\Tests\Framework\BaseTest;
+use Spiral\Tests\Framework\BaseTestCase;
use Spiral\Views\Bootloader\ViewsBootloader;
use Spiral\Views\Config\ViewsConfig;
use Spiral\Views\DependencyInterface;
@@ -17,7 +17,7 @@
use Spiral\Views\ViewManager;
use Spiral\Views\ViewsInterface;
-final class ViewsBootloaderTest extends BaseTest
+final class ViewsBootloaderTest extends BaseTestCase
{
public function testViewsInterfaceBinding(): void
{
diff --git a/tests/Framework/Console/CommandDescriptionTest.php b/tests/Framework/Console/CommandDescriptionTest.php
index 2a8d0afc3..44c047de2 100644
--- a/tests/Framework/Console/CommandDescriptionTest.php
+++ b/tests/Framework/Console/CommandDescriptionTest.php
@@ -4,9 +4,9 @@
namespace Framework\Console;
-use Spiral\Tests\Framework\ConsoleTest;
+use Spiral\Tests\Framework\ConsoleTestCase;
-final class CommandDescriptionTest extends ConsoleTest
+final class CommandDescriptionTest extends ConsoleTestCase
{
public function testAllCommandsShouldHaveDescription(): void
{
diff --git a/tests/Framework/Console/Confirmation/ApplicationInProductionTest.php b/tests/Framework/Console/Confirmation/ApplicationInProductionTest.php
index 320d6839e..5c6df2e6d 100644
--- a/tests/Framework/Console/Confirmation/ApplicationInProductionTest.php
+++ b/tests/Framework/Console/Confirmation/ApplicationInProductionTest.php
@@ -5,6 +5,7 @@
namespace Framework\Console\Confirmation;
use Mockery as m;
+use PHPUnit\Framework\Attributes\DataProvider;
use PHPUnit\Framework\TestCase;
use Spiral\Boot\Environment\AppEnvironment;
use Spiral\Console\Confirmation\ApplicationInProduction;
@@ -13,9 +14,7 @@
final class ApplicationInProductionTest extends TestCase
{
- /**
- * @dataProvider notProductionEnvs
- */
+ #[DataProvider('notProductionEnvs')]
public function testNotProductionEnvironmentShouldBeConfirmed(AppEnvironment $env): void
{
$confirmation = new ApplicationInProduction(
@@ -79,12 +78,10 @@ public function testProductionEnvShouldBeAskAboutConfirmationAndNotConfirmed():
$this->assertFalse($confirmation->confirmToProceed());
}
- public function notProductionEnvs(): array
+ public static function notProductionEnvs(): \Traversable
{
- return [
- 'Local' => [AppEnvironment::Local],
- 'Testing' => [AppEnvironment::Testing],
- 'Stage' => [AppEnvironment::Stage],
- ];
+ yield 'Local' => [AppEnvironment::Local];
+ yield 'Testing' => [AppEnvironment::Testing];
+ yield 'Stage' => [AppEnvironment::Stage];
}
}
diff --git a/tests/Framework/ConsoleTest.php b/tests/Framework/ConsoleTestCase.php
similarity index 78%
rename from tests/Framework/ConsoleTest.php
rename to tests/Framework/ConsoleTestCase.php
index ce255d13d..f3ae4a59b 100644
--- a/tests/Framework/ConsoleTest.php
+++ b/tests/Framework/ConsoleTestCase.php
@@ -4,7 +4,7 @@
namespace Spiral\Tests\Framework;
-abstract class ConsoleTest extends BaseTest
+abstract class ConsoleTestCase extends BaseTestCase
{
public function tearDown(): void
{
diff --git a/tests/Framework/Controller/AuthorizesTest.php b/tests/Framework/Controller/AuthorizesTest.php
index 8bb2c7f7b..90a099777 100644
--- a/tests/Framework/Controller/AuthorizesTest.php
+++ b/tests/Framework/Controller/AuthorizesTest.php
@@ -14,14 +14,14 @@
use Spiral\Security\GuardInterface;
use Spiral\Security\GuardScope;
use Spiral\App\Controller\AuthController;
-use Spiral\Tests\Framework\BaseTest;
+use Spiral\Tests\Framework\BaseTestCase;
-final class AuthorizesTest extends BaseTest
+final class AuthorizesTest extends BaseTestCase
{
public function testAuthException(): void
{
$this->expectException(ControllerException::class);
- $this->expectDeprecationMessage("Unauthorized permission 'do'");
+ $this->expectExceptionMessage("Unauthorized permission 'do'");
$this->getContainer()
->bind(ActorInterface::class, new Guest());
diff --git a/tests/Framework/Dispatcher/ConsoleDispatcherTest.php b/tests/Framework/Dispatcher/ConsoleDispatcherTest.php
index 23894c9c9..301de58ae 100644
--- a/tests/Framework/Dispatcher/ConsoleDispatcherTest.php
+++ b/tests/Framework/Dispatcher/ConsoleDispatcherTest.php
@@ -5,11 +5,11 @@
namespace Spiral\Tests\Framework\Dispatcher;
use Spiral\Console\ConsoleDispatcher;
-use Spiral\Tests\Framework\BaseTest;
+use Spiral\Tests\Framework\BaseTestCase;
use Symfony\Component\Console\Input\ArrayInput;
use Symfony\Component\Console\Output\BufferedOutput;
-final class ConsoleDispatcherTest extends BaseTest
+final class ConsoleDispatcherTest extends BaseTestCase
{
public const MAKE_APP_ON_STARTUP = false;
diff --git a/tests/Framework/Encrypter/KeyCommandTest.php b/tests/Framework/Encrypter/KeyCommandTest.php
index 3108f7770..10bb0a774 100644
--- a/tests/Framework/Encrypter/KeyCommandTest.php
+++ b/tests/Framework/Encrypter/KeyCommandTest.php
@@ -6,9 +6,9 @@
use Spiral\Console\Console;
use Spiral\Encrypter\EncrypterFactory;
-use Spiral\Tests\Framework\ConsoleTest;
+use Spiral\Tests\Framework\ConsoleTestCase;
-final class KeyCommandTest extends ConsoleTest
+final class KeyCommandTest extends ConsoleTestCase
{
public function testKey(): void
{
diff --git a/tests/Framework/Filter/FilterTestCase.php b/tests/Framework/Filter/FilterTestCase.php
index e24f7451f..be85eecc1 100644
--- a/tests/Framework/Filter/FilterTestCase.php
+++ b/tests/Framework/Filter/FilterTestCase.php
@@ -9,9 +9,9 @@
use Spiral\Filter\InputScope;
use Spiral\Filters\Model\FilterInterface;
use Spiral\Filters\Model\FilterProviderInterface;
-use Spiral\Tests\Framework\BaseTest;
+use Spiral\Tests\Framework\BaseTestCase;
-abstract class FilterTestCase extends BaseTest
+abstract class FilterTestCase extends BaseTestCase
{
/**
* @param class-string $filter
diff --git a/tests/Framework/Filter/JsonErrorsRendererTest.php b/tests/Framework/Filter/JsonErrorsRendererTest.php
index 97040f717..f453d34d7 100644
--- a/tests/Framework/Filter/JsonErrorsRendererTest.php
+++ b/tests/Framework/Filter/JsonErrorsRendererTest.php
@@ -6,9 +6,9 @@
use Spiral\Filter\JsonErrorsRenderer;
use Spiral\Http\ResponseWrapper;
-use Spiral\Tests\Framework\BaseTest;
+use Spiral\Tests\Framework\BaseTestCase;
-final class JsonErrorsRendererTest extends BaseTest
+final class JsonErrorsRendererTest extends BaseTestCase
{
public function testRender(): void
{
diff --git a/tests/Framework/Filter/Model/NestedArrayFiltersTest.php b/tests/Framework/Filter/Model/NestedArrayFiltersTest.php
index 5af2ffa31..a899ca797 100644
--- a/tests/Framework/Filter/Model/NestedArrayFiltersTest.php
+++ b/tests/Framework/Filter/Model/NestedArrayFiltersTest.php
@@ -4,6 +4,7 @@
namespace Spiral\Tests\Framework\Filter\Model;
+use PHPUnit\Framework\Attributes\DataProvider;
use Spiral\App\Request\AddressFilter;
use Spiral\App\Request\MultipleAddressesFilter;
use Spiral\Filters\Exception\ValidationException;
@@ -40,14 +41,12 @@ public function testGetsNestedFilter(): void
$this->assertSame('Hollywood', $filter->addresses[1]->address);
}
- /**
- * @dataProvider provideInvalidData
- */
+ #[DataProvider('provideInvalidData')]
public function testDataShouldBeValidated(array $data, array $expectedErrors): void
{
if ($expectedErrors !== []) {
$this->expectException(ValidationException::class);
- $this->expectErrorMessage('The given data was invalid.');
+ $this->expectExceptionMessage('The given data was invalid.');
}
try {
@@ -59,7 +58,7 @@ public function testDataShouldBeValidated(array $data, array $expectedErrors): v
}
}
- public function provideInvalidData(): \Generator
+ public static function provideInvalidData(): \Generator
{
yield 'empty' => [
[],
diff --git a/tests/Framework/Filter/Model/NestedFilterTest.php b/tests/Framework/Filter/Model/NestedFilterTest.php
index 63e13f3ba..0f632d5fd 100644
--- a/tests/Framework/Filter/Model/NestedFilterTest.php
+++ b/tests/Framework/Filter/Model/NestedFilterTest.php
@@ -4,6 +4,7 @@
namespace Spiral\Tests\Framework\Filter\Model;
+use PHPUnit\Framework\Attributes\DataProvider;
use Spiral\App\Request\AddressFilter;
use Spiral\App\Request\ProfileFilter;
use Spiral\App\Request\ProfileFilterWithPrefix;
@@ -48,13 +49,11 @@ public function testGetsNestedFilterWithCustomPrefix(): void
$this->assertSame('Wall Street', $filter->address->address);
}
- /**
- * @dataProvider provideInvalidData
- */
+ #[DataProvider('provideInvalidData')]
public function testDataShouldBeValidated(array $data, array $expectedErrors): void
{
$this->expectException(ValidationException::class);
- $this->expectErrorMessage('The given data was invalid.');
+ $this->expectExceptionMessage('The given data was invalid.');
try {
$this->getFilter(ProfileFilter::class, $data);
@@ -64,7 +63,7 @@ public function testDataShouldBeValidated(array $data, array $expectedErrors): v
}
}
- public function provideInvalidData(): \Generator
+ public static function provideInvalidData(): \Generator
{
yield 'empty' => [
[],
diff --git a/tests/Framework/Framework/CleanTest.php b/tests/Framework/Framework/CleanTest.php
index 9df579016..0eed5c461 100644
--- a/tests/Framework/Framework/CleanTest.php
+++ b/tests/Framework/Framework/CleanTest.php
@@ -4,13 +4,13 @@
namespace Spiral\Tests\Framework\Framework;
-use Spiral\Tests\Framework\ConsoleTest;
+use Spiral\Tests\Framework\ConsoleTestCase;
use Symfony\Component\Console\Output\OutputInterface;
/**
* @covers \Spiral\Command\CleanCommand
*/
-final class CleanTest extends ConsoleTest
+final class CleanTest extends ConsoleTestCase
{
public int $defaultVerbosityLevel = OutputInterface::VERBOSITY_DEBUG;
diff --git a/tests/Framework/Framework/ExtensionsCommand.php b/tests/Framework/Framework/ExtensionsCommand.php
index 276de2afd..9808a1520 100644
--- a/tests/Framework/Framework/ExtensionsCommand.php
+++ b/tests/Framework/Framework/ExtensionsCommand.php
@@ -4,10 +4,10 @@
namespace Spiral\Tests\Framework\Framework;
-use Spiral\Tests\Framework\ConsoleTest;
+use Spiral\Tests\Framework\ConsoleTestCase;
use Symfony\Component\Console\Output\OutputInterface;
-final class ExtensionsCommand extends ConsoleTest
+final class ExtensionsCommand extends ConsoleTestCase
{
public int $defaultVerbosityLevel = OutputInterface::VERBOSITY_DEBUG;
diff --git a/tests/Framework/Framework/KernelTest.php b/tests/Framework/Framework/KernelTest.php
index 08839c8cc..9ac9e1b15 100644
--- a/tests/Framework/Framework/KernelTest.php
+++ b/tests/Framework/Framework/KernelTest.php
@@ -5,9 +5,9 @@
namespace Framework\Framework;
use Spiral\App\TestApp;
-use Spiral\Tests\Framework\BaseTest;
+use Spiral\Tests\Framework\BaseTestCase;
-final class KernelTest extends BaseTest
+final class KernelTest extends BaseTestCase
{
public function testAppBootingCallbacks()
{
diff --git a/tests/Framework/Framework/RouteListTest.php b/tests/Framework/Framework/RouteListTest.php
index 679230fcf..b3ae0cee1 100644
--- a/tests/Framework/Framework/RouteListTest.php
+++ b/tests/Framework/Framework/RouteListTest.php
@@ -4,9 +4,9 @@
namespace Spiral\Tests\Framework\Framework;
-use Spiral\Tests\Framework\ConsoleTest;
+use Spiral\Tests\Framework\ConsoleTestCase;
-final class RouteListTest extends ConsoleTest
+final class RouteListTest extends ConsoleTestCase
{
public function testExtensions(): void
{
diff --git a/tests/Framework/Http/AuthSessionTest.php b/tests/Framework/Http/AuthSessionTest.php
index 201e76eb0..abb964f4e 100644
--- a/tests/Framework/Http/AuthSessionTest.php
+++ b/tests/Framework/Http/AuthSessionTest.php
@@ -4,9 +4,9 @@
namespace Spiral\Tests\Framework\Http;
-use Spiral\Tests\Framework\HttpTest;
+use Spiral\Tests\Framework\HttpTestCase;
-final class AuthSessionTest extends HttpTest
+final class AuthSessionTest extends HttpTestCase
{
public const ENV = [
'ENCRYPTER_KEY' => self::ENCRYPTER_KEY,
diff --git a/tests/Framework/Http/ControllerTest.php b/tests/Framework/Http/ControllerTest.php
index 6e7b70bfd..8affb3842 100644
--- a/tests/Framework/Http/ControllerTest.php
+++ b/tests/Framework/Http/ControllerTest.php
@@ -5,9 +5,9 @@
namespace Spiral\Tests\Framework\Http;
use Nyholm\Psr7\Factory\Psr17Factory;
-use Spiral\Tests\Framework\HttpTest;
+use Spiral\Tests\Framework\HttpTestCase;
-final class ControllerTest extends HttpTest
+final class ControllerTest extends HttpTestCase
{
public function testIndexAction(): void
{
diff --git a/tests/Framework/Http/CookiesTest.php b/tests/Framework/Http/CookiesTest.php
index 49119554f..59b67a80e 100644
--- a/tests/Framework/Http/CookiesTest.php
+++ b/tests/Framework/Http/CookiesTest.php
@@ -8,9 +8,9 @@
use Spiral\Cookies\CookieManager;
use Spiral\Core\Exception\ScopeException;
use Spiral\Encrypter\EncrypterInterface;
-use Spiral\Tests\Framework\HttpTest;
+use Spiral\Tests\Framework\HttpTestCase;
-final class CookiesTest extends HttpTest
+final class CookiesTest extends HttpTestCase
{
public const ENV = [
'ENCRYPTER_KEY' => self::ENCRYPTER_KEY,
diff --git a/tests/Framework/Http/ErrorHandler/PlainRendererTest.php b/tests/Framework/Http/ErrorHandler/PlainRendererTest.php
index f523fb798..9c116b6dd 100644
--- a/tests/Framework/Http/ErrorHandler/PlainRendererTest.php
+++ b/tests/Framework/Http/ErrorHandler/PlainRendererTest.php
@@ -6,6 +6,7 @@
use GuzzleHttp\Psr7\Response;
use Nyholm\Psr7\ServerRequest;
+use PHPUnit\Framework\Attributes\DataProvider;
use PHPUnit\Framework\TestCase;
use Psr\Http\Message\ResponseFactoryInterface;
use Spiral\Http\ErrorHandler\PlainRenderer;
@@ -42,9 +43,7 @@ public function testNoAcceptHeader(): void
self::assertEquals('Error code: 400', $stream->getContents());
}
- /**
- * @dataProvider dataResponseIsJson
- */
+ #[DataProvider('dataResponseIsJson')]
public function testResponseIsJson(): void
{
$renderer = new PlainRenderer($this->mockResponseFactory());
@@ -64,7 +63,7 @@ public function testResponseIsJson(): void
self::assertJsonStringEqualsJsonString('{"status": 400}', $stream->getContents());
}
- public function dataResponseIsJson(): iterable
+ public static function dataResponseIsJson(): iterable
{
yield [
'application/json',
@@ -87,9 +86,7 @@ public function dataResponseIsJson(): iterable
];
}
- /**
- * @dataProvider dataResponseIsPlain
- */
+ #[DataProvider('dataResponseIsPlain')]
public function testResponseIsPlain($acceptHeader): void
{
$renderer = new PlainRenderer($this->mockResponseFactory());
@@ -101,7 +98,7 @@ public function testResponseIsPlain($acceptHeader): void
self::assertEquals('Error code: 400', $stream->getContents());
}
- public function dataResponseIsPlain(): iterable
+ public static function dataResponseIsPlain(): iterable
{
//Accept header contains several mime types with `q` values. JSON is not prioritized
yield [
diff --git a/tests/Framework/Http/FilterTest.php b/tests/Framework/Http/FilterTest.php
index 23e1993de..f8130d3eb 100644
--- a/tests/Framework/Http/FilterTest.php
+++ b/tests/Framework/Http/FilterTest.php
@@ -4,9 +4,9 @@
namespace Spiral\Tests\Framework\Http;
-use Spiral\Tests\Framework\HttpTest;
+use Spiral\Tests\Framework\HttpTestCase;
-final class FilterTest extends HttpTest
+final class FilterTest extends HttpTestCase
{
public function testValid(): void
{
diff --git a/tests/Framework/Http/PaginationTest.php b/tests/Framework/Http/PaginationTest.php
index 04aa9f18a..e8172062e 100644
--- a/tests/Framework/Http/PaginationTest.php
+++ b/tests/Framework/Http/PaginationTest.php
@@ -6,9 +6,9 @@
use Spiral\Core\Exception\ScopeException;
use Spiral\Http\PaginationFactory;
-use Spiral\Tests\Framework\HttpTest;
+use Spiral\Tests\Framework\HttpTestCase;
-final class PaginationTest extends HttpTest
+final class PaginationTest extends HttpTestCase
{
public function testPaginate(): void
{
diff --git a/tests/Framework/Http/SessionTest.php b/tests/Framework/Http/SessionTest.php
index 3c6550bd1..97cce4af2 100644
--- a/tests/Framework/Http/SessionTest.php
+++ b/tests/Framework/Http/SessionTest.php
@@ -5,9 +5,9 @@
namespace Spiral\Tests\Framework\Http;
use Spiral\Session\SessionInterface;
-use Spiral\Tests\Framework\HttpTest;
+use Spiral\Tests\Framework\HttpTestCase;
-final class SessionTest extends HttpTest
+final class SessionTest extends HttpTestCase
{
public function setUp(): void
{
diff --git a/tests/Framework/HttpTest.php b/tests/Framework/HttpTestCase.php
similarity index 96%
rename from tests/Framework/HttpTest.php
rename to tests/Framework/HttpTestCase.php
index 8a49150a3..e038e98fd 100644
--- a/tests/Framework/HttpTest.php
+++ b/tests/Framework/HttpTestCase.php
@@ -11,7 +11,7 @@
use Spiral\Session\Middleware\SessionMiddleware;
use Spiral\Testing\Http\FakeHttp;
-abstract class HttpTest extends BaseTest
+abstract class HttpTestCase extends BaseTestCase
{
public const ENCRYPTER_KEY = 'def00000b325585e24ff3bd2d2cd273aa1d2274cb6851a9f2c514c2e2a83806f2661937f8b9cbe217e37943f5f9ccb6b5f91151606774869883e5557a941dfd879cbf5be';
private FakeHttp $http;
diff --git a/tests/Framework/I18n/ExportTest.php b/tests/Framework/I18n/ExportTest.php
index 1a066a72c..6c5e56f9d 100644
--- a/tests/Framework/I18n/ExportTest.php
+++ b/tests/Framework/I18n/ExportTest.php
@@ -4,9 +4,9 @@
namespace Spiral\Tests\Framework\I18n;
-use Spiral\Tests\Framework\ConsoleTest;
+use Spiral\Tests\Framework\ConsoleTestCase;
-final class ExportTest extends ConsoleTest
+final class ExportTest extends ConsoleTestCase
{
public function tearDown(): void
{
diff --git a/tests/Framework/I18n/ResetTest.php b/tests/Framework/I18n/ResetTest.php
index c4cf1e4c0..f8eb64c30 100644
--- a/tests/Framework/I18n/ResetTest.php
+++ b/tests/Framework/I18n/ResetTest.php
@@ -4,9 +4,9 @@
namespace Spiral\Tests\Framework\I18n;
-use Spiral\Tests\Framework\ConsoleTest;
+use Spiral\Tests\Framework\ConsoleTestCase;
-final class ResetTest extends ConsoleTest
+final class ResetTest extends ConsoleTestCase
{
public function testReset(): void
{
diff --git a/tests/Framework/Interceptor/GuardedTest.php b/tests/Framework/Interceptor/GuardedTest.php
index ea9d8fd1d..fd83bc52d 100644
--- a/tests/Framework/Interceptor/GuardedTest.php
+++ b/tests/Framework/Interceptor/GuardedTest.php
@@ -12,9 +12,9 @@
use Spiral\Core\Exception\InterceptorException;
use Spiral\Security\Actor\Actor;
use Spiral\Security\ActorInterface;
-use Spiral\Tests\Framework\BaseTest;
+use Spiral\Tests\Framework\BaseTestCase;
-final class GuardedTest extends BaseTest
+final class GuardedTest extends BaseTestCase
{
private function getCore(): CoreInterface
{
diff --git a/tests/Framework/Interceptor/PipelineInterceptorTest.php b/tests/Framework/Interceptor/PipelineInterceptorTest.php
index 42ba629c7..5cb8f60d2 100644
--- a/tests/Framework/Interceptor/PipelineInterceptorTest.php
+++ b/tests/Framework/Interceptor/PipelineInterceptorTest.php
@@ -4,9 +4,9 @@
namespace Spiral\Tests\Framework\Interceptor;
-use Spiral\Tests\Framework\HttpTest;
+use Spiral\Tests\Framework\HttpTestCase;
-final class PipelineInterceptorTest extends HttpTest
+final class PipelineInterceptorTest extends HttpTestCase
{
public function testWithoutPipeline(): void
{
diff --git a/tests/Framework/KernelTest.php b/tests/Framework/KernelTest.php
index 94ac8d541..9e1a7ea46 100644
--- a/tests/Framework/KernelTest.php
+++ b/tests/Framework/KernelTest.php
@@ -9,7 +9,7 @@
use Spiral\Core\Container;
use stdClass;
-class KernelTest extends BaseTest
+class KernelTest extends BaseTestCase
{
public const MAKE_APP_ON_STARTUP = false;
diff --git a/tests/Framework/Module/PublishTest.php b/tests/Framework/Module/PublishTest.php
index 7ecb03904..b2fa596a5 100644
--- a/tests/Framework/Module/PublishTest.php
+++ b/tests/Framework/Module/PublishTest.php
@@ -6,9 +6,9 @@
use Spiral\Boot\DirectoriesInterface;
use Spiral\Module\Exception\PublishException;
-use Spiral\Tests\Framework\ConsoleTest;
+use Spiral\Tests\Framework\ConsoleTestCase;
-final class PublishTest extends ConsoleTest
+final class PublishTest extends ConsoleTestCase
{
protected const TEST_FILE = __DIR__ . '/test.txt';
protected const TEST_FILE_2 = __DIR__ . '/PublishTest.php';
diff --git a/tests/Framework/MonorepoBuilder/ValidateVersionReleaseWorkerTest.php b/tests/Framework/MonorepoBuilder/ValidateVersionReleaseWorkerTest.php
index 4e1fcdb54..5aff9d361 100644
--- a/tests/Framework/MonorepoBuilder/ValidateVersionReleaseWorkerTest.php
+++ b/tests/Framework/MonorepoBuilder/ValidateVersionReleaseWorkerTest.php
@@ -7,6 +7,7 @@
use MonorepoBuilder\TagParserInterface;
use MonorepoBuilder\ValidateVersionReleaseWorker;
use PharIo\Version\Version;
+use PHPUnit\Framework\Attributes\DataProvider;
use PHPUnit\Framework\TestCase;
// Monorepo builder doesn't have autoloading
@@ -39,7 +40,7 @@ protected function setUp(): void
$this->worker = new ValidateVersionReleaseWorker($this->initTagParser(self::TAGS), '');
}
- /** @dataProvider dataVersions */
+ #[DataProvider('dataVersions')]
public function testFindMostRecentVersion(string $version, string $exceptMaxVersion): void
{
$method = new \ReflectionMethod($this->worker, 'findMostRecentVersion');
@@ -47,7 +48,7 @@ public function testFindMostRecentVersion(string $version, string $exceptMaxVers
$this->assertSame($method->invoke($this->worker, new Version(\strtolower($version))), $exceptMaxVersion);
}
- public function dataVersions(): \Traversable
+ public static function dataVersions(): \Traversable
{
yield ['0.1.1', '0.1.11'];
yield ['0.1.11', '0.1.11'];
diff --git a/tests/Framework/Router/Loader/Configurator/ImportConfiguratorTest.php b/tests/Framework/Router/Loader/Configurator/ImportConfiguratorTest.php
index 0c96be3eb..cb90c8afa 100644
--- a/tests/Framework/Router/Loader/Configurator/ImportConfiguratorTest.php
+++ b/tests/Framework/Router/Loader/Configurator/ImportConfiguratorTest.php
@@ -7,9 +7,9 @@
use Spiral\App\Bootloader\RoutesBootloader;
use Spiral\Router\GroupRegistry;
use Spiral\Router\RouterInterface;
-use Spiral\Tests\Framework\BaseTest;
+use Spiral\Tests\Framework\BaseTestCase;
-final class ImportConfiguratorTest extends BaseTest
+final class ImportConfiguratorTest extends BaseTestCase
{
public function testImport(): void
{
diff --git a/tests/Framework/SnapshotTest.php b/tests/Framework/SnapshotTest.php
index cc68c95d8..5096bc406 100644
--- a/tests/Framework/SnapshotTest.php
+++ b/tests/Framework/SnapshotTest.php
@@ -7,7 +7,7 @@
use Spiral\Snapshots\SnapshotInterface;
use Spiral\Snapshots\SnapshotterInterface;
-final class SnapshotTest extends BaseTest
+final class SnapshotTest extends BaseTestCase
{
public function testStringConfigParams()
{
diff --git a/tests/Framework/Views/CompileTest.php b/tests/Framework/Views/CompileTest.php
index d93eb4d0b..083c7ab56 100644
--- a/tests/Framework/Views/CompileTest.php
+++ b/tests/Framework/Views/CompileTest.php
@@ -6,14 +6,14 @@
use Spiral\Boot\DirectoriesInterface;
use Spiral\Files\FilesInterface;
-use Spiral\Tests\Framework\ConsoleTest;
+use Spiral\Tests\Framework\ConsoleTestCase;
use Symfony\Component\Console\Output\OutputInterface;
/**
* @covers \Spiral\Command\Views\ResetCommand
* @covers \Spiral\Command\Views\CompileCommand
*/
-final class CompileTest extends ConsoleTest
+final class CompileTest extends ConsoleTestCase
{
public int $defaultVerbosityLevel = OutputInterface::VERBOSITY_DEBUG;
diff --git a/tests/Framework/Views/LocaleTest.php b/tests/Framework/Views/LocaleTest.php
index 387105513..c8f896cfd 100644
--- a/tests/Framework/Views/LocaleTest.php
+++ b/tests/Framework/Views/LocaleTest.php
@@ -4,10 +4,10 @@
namespace Spiral\Tests\Framework\Views;
-use Spiral\Tests\Framework\BaseTest;
+use Spiral\Tests\Framework\BaseTestCase;
use Spiral\Translator\Views\LocaleDependency;
-final class LocaleTest extends BaseTest
+final class LocaleTest extends BaseTestCase
{
public function testRenderEn(): void
{
diff --git a/tests/Framework/Views/RenderTest.php b/tests/Framework/Views/RenderTest.php
index bb3b8b4f4..dd23e909a 100644
--- a/tests/Framework/Views/RenderTest.php
+++ b/tests/Framework/Views/RenderTest.php
@@ -4,11 +4,11 @@
namespace Spiral\Tests\Framework\Views;
-use Spiral\Tests\Framework\BaseTest;
+use Spiral\Tests\Framework\BaseTestCase;
use Spiral\Views\GlobalVariablesInterface;
use Spiral\Views\ViewsInterface;
-final class RenderTest extends BaseTest
+final class RenderTest extends BaseTestCase
{
public function testWithNullVariable(): void
{