Exemplo n.º 1
0
 /**
  * @test
  * @covers ::getMessageForCode
  * @uses AyeAye\Api\Status::__construct
  */
 public function testGetMessageForCode()
 {
     $this->assertSame('OK', Status::getMessageForCode(200));
     $this->assertSame('Internal Server Error', Status::getMessageForCode(500));
     $this->assertNull(Status::getMessageForCode(9001));
 }
Exemplo n.º 2
0
 /**
  * @test
  * @covers ::createFailSafeResponse
  * @uses \AyeAye\Api\Api::__construct
  * @uses \AyeAye\Api\Status
  * @uses \AyeAye\Api\Response
  * @uses \AyeAye\Api\Request
  * @uses \AyeAye\Api\Injector\StatusInjector
  * @uses \AyeAye\Api\Injector\RequestInjector
  * @uses \AyeAye\Formatter\Writer\Json
  */
 public function testCreateFailSafeResponse()
 {
     // Mocks
     $controller = $this->getMockController();
     // Tests
     $api = new Api($controller);
     $createFailSafeResponse = $this->getObjectMethod($api, 'createFailSafeResponse');
     /** @var Response $response */
     $response = $createFailSafeResponse();
     $this->assertSame(500, $response->getStatus()->getCode());
     $this->assertSame(Status::getMessageForCode(500), $response->getBody()['data']);
 }