public function testGetEndpoints() { $endpoints = [Endpoint::get('/all', 'all'), Endpoint::get('/find/:id', 'find')]; foreach ($endpoints as $endpoint) { $this->collection->endpoint($endpoint); } $this->assertEquals($this->collection->getEndpoints(), $endpoints); }
public function setEndpoint($name, Endpoint $endpoint) { $this->endpoints[$name] = $endpoint; switch ($endpoint->getHttpMethod()) { case Http::GET: $this->get($endpoint->getPath(), $endpoint->getHandlerMethod()); break; case Http::POST: $this->post($endpoint->getPath(), $endpoint->getHandlerMethod()); break; case Http::PUT: $this->put($endpoint->getPath(), $endpoint->getHandlerMethod()); break; case Http::DELETE: $this->delete($endpoint->getPath(), $endpoint->getHandlerMethod()); break; } return $this; }
public function __construct($path = '/{id}', $httpMethod = Http::POST, $handlerMethod = 'create') { parent::__construct($path, $httpMethod, $handlerMethod); }
public function __construct($path = '/{id}', $httpMethod = Http::DELETE, $handlerMethod = 'delete') { parent::__construct($path, $httpMethod, $handlerMethod); }
public function testExpectsPostData() { $this->endpoint->expectsPostData(); $this->assertEquals($this->endpoint->getPostedDataMethod(), PostedDataMethods::POST); }
public function __construct($path = '/{id}', $httpMethod = Http::GET, $handlerMethod = 'find') { parent::__construct($path, $httpMethod, $handlerMethod); }