Beispiel #1
0
 /**
  * @covers Respect\Rest\Routes\AbstractRoute::match
  * @dataProvider extensions_provider
  */
 public function testIgnoreFileExtensions($with, $without)
 {
     $_SERVER['HTTP_ACCEPT'] = '*';
     $_SERVER['REQUEST_URI'] = '/';
     $r = new Router();
     $r->get('/route1/*', function ($match) {
         return $match;
     });
     $r->get('/route2/*', function ($match) {
         return $match;
     })->accept(array('.json-home' => function ($data) {
         return factory::respond(E2M::mediaType('.json-home'), $data);
     }, "*" => function ($data) {
         return "{$data}.accepted";
     }));
     $response = $r->dispatch('get', "/route1/{$with}")->response();
     $this->assertEquals($with, $response);
     $response = $r->dispatch('get', "/route2/{$with}")->response();
     $this->assertEquals("{$without}.accepted", $response);
 }