Skip to content

Commit 2fcc495

Browse files
authored
Update phpunit syntax to use attributes instead of annotations (#1210)
1 parent a735f82 commit 2fcc495

File tree

5 files changed

+7
-12
lines changed

5 files changed

+7
-12
lines changed

src/AnnotatedRoutes/tests/TestCase.php

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,7 @@
88
use Spiral\Router\Bootloader\AnnotatedRoutesBootloader;
99
use Spiral\Testing\TestCase as BaseTestCase;
1010

11-
/**
12-
* @requires function \Spiral\Framework\Kernel::init
13-
*/
11+
#[\PHPUnit\Framework\Attributes\RequiresMethod(\Spiral\Framework\Kernel::class, 'init')]
1412
abstract class TestCase extends BaseTestCase
1513
{
1614
public function defineBootloaders(): array

src/Core/tests/Exception/ClosureRendererTraitTest.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -100,10 +100,9 @@ public function testDefaultScalarValues(): void
100100
}
101101

102102
/**
103-
* @requires PHP >= 8.2
104-
*
105103
* @link https://wiki.php.net/rfc/null-false-standalone-types
106104
*/
105+
#[\PHPUnit\Framework\Attributes\RequiresPhp('>= 8.2')]
107106
public function testNullAndFalseTypes(): void
108107
{
109108
eval('$fn = fn (null $a, false $b) => null;');

src/Router/tests/RouterTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,6 @@ public function testImportWithHost(): void
9292

9393
$uri = (string) $router->uri('foo', ['host' => 'some']);
9494
self::assertSame('some/register', $uri);
95-
self::assertFalse(\str_contains('https://host.com', $uri));
95+
self::assertStringNotContainsString($uri, 'https://host.com');
9696
}
9797
}

src/Session/tests/SessionTest.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44

55
namespace Spiral\Tests\Session;
66

7+
use PHPUnit\Framework\Attributes\RunTestsInSeparateProcesses;
78
use Spiral\Core\Container;
89
use Spiral\Files\Files;
910
use Spiral\Files\FilesInterface;
@@ -15,6 +16,7 @@
1516
use Spiral\Session\SessionInterface;
1617
use Spiral\Session\SessionSection;
1718

19+
#[RunTestsInSeparateProcesses]
1820
final class SessionTest extends TestCase
1921
{
2022
private SessionFactory $factory;

src/Streams/tests/StreamsTest.php

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -61,9 +61,7 @@ public function testGetResource(): void
6161
self::assertSame('sample', \stream_get_contents($resource, 6, 0));
6262
}
6363

64-
/**
65-
* @requires PHP < 8.0
66-
*/
64+
#[\PHPUnit\Framework\Attributes\RequiresPhp('< 8.0')]
6765
public function testException(): void
6866
{
6967
try {
@@ -79,9 +77,7 @@ public function testException(): void
7977
}
8078
}
8179

82-
/**
83-
* @requires PHP >= 8.0
84-
*/
80+
#[\PHPUnit\Framework\Attributes\RequiresPhp('>= 8.0')]
8581
public function testExceptionPHP8(): void
8682
{
8783
try {

0 commit comments

Comments
 (0)