Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update to latest PHPUnit 10 syntax #70

Merged
merged 1 commit into from
Nov 4, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 17 additions & 1 deletion psalm-baseline.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<files psalm-version="5.25.0@01a8eb06b9e9cc6cfb6a320bf9fb14331919d505">
<files psalm-version="5.26.1@d747f6500b38ac4f7dfc5edbcae6e4b637d7add0">
<file src="src/Middleware/DoublePassMiddlewareDecorator.php">
<UnusedClosureParam>
<code><![CDATA[$response]]></code>
Expand All @@ -15,4 +15,20 @@
<code><![CDATA[ResponseInterface]]></code>
</PossiblyUnusedReturnValue>
</file>
<file src="test/Exception/ExceptionTest.php">
<PossiblyUnusedMethod>
<code><![CDATA[exception]]></code>
</PossiblyUnusedMethod>
</file>
<file src="test/Middleware/HostMiddlewareDecoratorTest.php">
<PossiblyUnusedMethod>
<code><![CDATA[matchingHost]]></code>
</PossiblyUnusedMethod>
</file>
<file src="test/Middleware/PathMiddlewareDecoratorTest.php">
<PossiblyUnusedMethod>
<code><![CDATA[nestedPathCombinations]]></code>
<code><![CDATA[rootPathsProvider]]></code>
</PossiblyUnusedMethod>
</file>
</files>
5 changes: 2 additions & 3 deletions test/Exception/ExceptionTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@

use Generator;
use Laminas\Stratigility\Exception\ExceptionInterface;
use PHPUnit\Framework\Attributes\DataProvider;
use PHPUnit\Framework\TestCase;

use function basename;
Expand All @@ -28,9 +29,7 @@ public static function exception(): Generator
}
}

/**
* @dataProvider exception
*/
#[DataProvider('exception')]
public function testExceptionIsInstanceOfExceptionInterface(string $exception): void
{
self::assertStringContainsString('Exception', $exception);
Expand Down
5 changes: 2 additions & 3 deletions test/Middleware/HostMiddlewareDecoratorTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@

use Generator;
use Laminas\Stratigility\Middleware\HostMiddlewareDecorator;
use PHPUnit\Framework\Attributes\DataProvider;
use PHPUnit\Framework\MockObject\MockObject;
use PHPUnit\Framework\TestCase;
use Psr\Http\Message\ResponseInterface;
Expand Down Expand Up @@ -69,9 +70,7 @@ public static function matchingHost(): Generator
yield ['host.foo', 'hOsT.fOO'];
}

/**
* @dataProvider matchingHost
*/
#[DataProvider('matchingHost')]
public function testDelegatesOriginalRequestToDecoratedMiddleware(string $requestHost, string $decoratorHost): void
{
$this->uri
Expand Down
12 changes: 5 additions & 7 deletions test/Middleware/PathMiddlewareDecoratorTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@
use Laminas\Diactoros\Uri;
use Laminas\Stratigility\Middleware\PathMiddlewareDecorator;
use PHPUnit\Framework\Assert;
use PHPUnit\Framework\Attributes\DataProvider;
use PHPUnit\Framework\Attributes\Group;
use PHPUnit\Framework\MockObject\MockObject;
use PHPUnit\Framework\TestCase;
use Psr\Http\Message\ResponseInterface;
Expand Down Expand Up @@ -238,9 +240,7 @@ public static function nestedPathCombinations(): array
];
}

/**
* @dataProvider nestedPathCombinations
*/
#[DataProvider('nestedPathCombinations')]
public function testNestedMiddlewareOnlyMatchesAtPathBoundaries(
string $prefix,
string $nestPrefix,
Expand Down Expand Up @@ -302,10 +302,8 @@ public static function rootPathsProvider(): array
];
}

/**
* @group matching
* @dataProvider rootPathsProvider
*/
#[DataProvider('rootPathsProvider')]
#[Group('matching')]
public function testTreatsBothSlashAndEmptyPathAsTheRootPath(string $path): void
{
$finalHandler = $this->createMock(RequestHandlerInterface::class);
Expand Down
5 changes: 2 additions & 3 deletions test/MiddlewarePipeTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
use Laminas\Stratigility\IterableMiddlewarePipeInterface;
use Laminas\Stratigility\MiddlewarePipe;
use Laminas\Stratigility\MiddlewarePipeInterface;
use PHPUnit\Framework\Attributes\Group;
use PHPUnit\Framework\TestCase;
use Psr\Http\Message\ResponseInterface;
use Psr\Http\Message\ServerRequestInterface;
Expand Down Expand Up @@ -50,9 +51,7 @@ private function createFinalHandler(): RequestHandlerInterface
return $handler;
}

/**
* @group http-interop
*/
#[Group('http-interop')]
public function testCanPipeInteropMiddleware(): void
{
$handler = $this->createMock(RequestHandlerInterface::class);
Expand Down
17 changes: 5 additions & 12 deletions test/NextTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
use LaminasTest\Stratigility\TestAsset\DelegatingMiddleware;
use LaminasTest\Stratigility\TestAsset\ShortCircuitingMiddleware;
use PHPUnit\Framework\Assert;
use PHPUnit\Framework\Attributes\Group;
use PHPUnit\Framework\MockObject\MockObject;
use PHPUnit\Framework\TestCase;
use Psr\Http\Message\ResponseInterface;
Expand Down Expand Up @@ -61,9 +62,7 @@ public function createDefaultResponse(): ResponseInterface
return $this->response;
}

/**
* @group http-interop
*/
#[Group('http-interop')]
public function testNextImplementsRequestHandlerInterface(): void
{
$next = new Next($this->queue, $this->fallbackHandler);
Expand Down Expand Up @@ -114,9 +113,7 @@ public function process(
$this->assertNotSame($this->response, $response);
}

/**
* @group http-interop
*/
#[Group('http-interop')]
public function testNextDelegatesToFallbackHandlerWhenQueueIsEmpty(): void
{
$expectedResponse = $this->createMock(ResponseInterface::class);
Expand All @@ -130,9 +127,7 @@ public function testNextDelegatesToFallbackHandlerWhenQueueIsEmpty(): void
$this->assertSame($expectedResponse, $next->handle($this->request));
}

/**
* @group http-interop
*/
#[Group('http-interop')]
public function testNextProcessesEnqueuedMiddleware(): void
{
$fallbackHandler = $this->createMock(RequestHandlerInterface::class);
Expand All @@ -157,9 +152,7 @@ public function testNextProcessesEnqueuedMiddleware(): void
$this->assertSame($response, $next->handle($this->request));
}

/**
* @group http-interop
*/
#[Group('http-interop')]
public function testMiddlewareReturningResponseShortCircuitsProcess(): void
{
$fallbackHandler = $this->createMock(RequestHandlerInterface::class);
Expand Down