27 lines
730 B
PHP
Raw Normal View History

2018-11-11 12:01:18 +01:00
<?php
namespace AppTest\Action;
2018-11-12 07:09:32 +01:00
use App\Handler\PingHandler;
2018-11-11 12:01:18 +01:00
use Interop\Http\ServerMiddleware\DelegateInterface;
use PHPUnit\Framework\TestCase;
use Psr\Http\Message\ServerRequestInterface;
use Zend\Diactoros\Response\JsonResponse;
class PingActionTest extends TestCase
{
public function testResponse()
{
2018-11-12 07:09:32 +01:00
$pingAction = new PingHandler();
2018-11-11 12:01:18 +01:00
$response = $pingAction->process(
$this->prophesize(ServerRequestInterface::class)->reveal(),
$this->prophesize(DelegateInterface::class)->reveal()
);
$json = json_decode((string) $response->getBody());
$this->assertInstanceOf(JsonResponse::class, $response);
$this->assertTrue(isset($json->ack));
}
}