29 lines
795 B
PHP
29 lines
795 B
PHP
<?php
|
|
|
|
namespace NoccyLabs\Mercureact\Http\Middleware;
|
|
|
|
use PHPUnit\Framework\Attributes\CoversClass;
|
|
use Psr\Http\Message\ResponseInterface;
|
|
use React\Http\Message\ServerRequest;
|
|
use React\Promise\Promise;
|
|
|
|
#[CoversClass(NotFoundHandler::class)]
|
|
class NotFoundHandlerTest extends \PHPUnit\Framework\TestCase
|
|
{
|
|
|
|
public function testAlwaysResolvesTo404Response()
|
|
{
|
|
|
|
$handler = new NotFoundHandler();
|
|
$request = new ServerRequest("GET", "/");
|
|
$result = null;
|
|
$promise = $handler->__invoke($request)->then(function ($r) use (&$result) {
|
|
$result = $r;
|
|
});
|
|
|
|
$this->assertInstanceOf(ResponseInterface::class, $result);
|
|
/** @var ResponseInterface $result */
|
|
$this->assertEquals(404, $result->getStatusCode());
|
|
}
|
|
|
|
} |