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);
 }
Example #2
0
 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;
 }
Example #3
0
 public function __construct($path = '/{id}', $httpMethod = Http::POST, $handlerMethod = 'create')
 {
     parent::__construct($path, $httpMethod, $handlerMethod);
 }
Example #4
0
 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);
 }
Example #6
0
 public function __construct($path = '/{id}', $httpMethod = Http::GET, $handlerMethod = 'find')
 {
     parent::__construct($path, $httpMethod, $handlerMethod);
 }