* initial version
This commit is contained in:
31
test/AppTest/Handler/PingHandlerTest.php
Normal file
31
test/AppTest/Handler/PingHandlerTest.php
Normal file
@@ -0,0 +1,31 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace AppTest\Handler;
|
||||
|
||||
use App\Handler\PingHandler;
|
||||
use Laminas\Diactoros\Response\JsonResponse;
|
||||
use PHPUnit\Framework\TestCase;
|
||||
use Prophecy\PhpUnit\ProphecyTrait;
|
||||
use Psr\Http\Message\ServerRequestInterface;
|
||||
|
||||
use function json_decode;
|
||||
|
||||
class PingHandlerTest extends TestCase
|
||||
{
|
||||
use ProphecyTrait;
|
||||
|
||||
public function testResponse()
|
||||
{
|
||||
$pingHandler = new PingHandler();
|
||||
$response = $pingHandler->handle(
|
||||
$this->prophesize(ServerRequestInterface::class)->reveal()
|
||||
);
|
||||
|
||||
$json = json_decode((string) $response->getBody());
|
||||
|
||||
$this->assertInstanceOf(JsonResponse::class, $response);
|
||||
$this->assertTrue(isset($json->ack));
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user