public function testUnkownHttpStatusExceptionGenerates500() { $app = new Application(); $app->get('/api/test/undefined-exception', function () { throw new Exception('Exception with unknown HTTP status', 999); }); Environment::mock(array('PATH_INFO' => '/api/test/undefined-exception')); $response = $app->invoke(); $this->assertEquals(json_encode(array('status' => 500, 'statusText' => 'Internal Server Error', 'description' => 'Exception with unknown HTTP status')), $response->getBody()); $this->assertEquals(500, $response->getStatus()); }
public function testGet() { $this->assertNotEquals(0, count($this->app->config['features'])); foreach ($this->app->config['features'] as $id => $feature) { $app = new Application(); Environment::mock(array('PATH_INFO' => '/features/' . $id)); $response = $app->invoke(); $this->assertEquals(json_encode(array_merge(array('id' => $id), $feature, array('href' => './api/features/' . $id))), $response->getBody()); $this->assertEquals(200, $response->getStatus()); } }