Example #1
0
 /**
  * POST request with params should CREATE row and return PRIMARY
  */
 public function testCreate()
 {
     $this->dispatchRouter('/test/rest/', ['name' => 'Splinter', 'email' => '*****@*****.**'], Http\Request::METHOD_POST);
     $primary = Db::fetchOne('SELECT id FROM `test` WHERE `name` = ?', ['Splinter']);
     $this->assertResponseCode(201);
     $this->assertEquals(Response::getHeader('Location'), '/test/rest/' . $primary);
 }
Example #2
0
 /**
  * OPTIONS request should set Allow header
  */
 public function testOptionsSet()
 {
     Request::setMethod(Request::METHOD_OPTIONS);
     $this->processRest();
     $this->assertEquals('HEAD,OPTIONS,GET,POST', Response::getHeader('Allow'));
 }