public function testAllowToStringReturnsHeaderFormattedString() { $allowHeader = new Allow(); $allowHeader->setAllowedMethods(array('GET', 'POST')); // @todo set some values, then test output $this->assertEquals('Allow: GET, POST', $allowHeader->toString()); }
/** * Tokens cannot be modified through the API. * * @param type $id */ public function patch($id, $data) { $allow = new Allow(); $allow->allowMethods(Response::PUT); $this->response->setStatusCode(405); $this->response->getHeaders()->addHeader($allow); return $this->response; }
/** * Creates an ALLOW header with the provided HTTP methods * * @param array $methods * @return Allow */ protected function createAllowHeaderWithAllowedMethods(array $methods) { // Need to create an Allow header. It has several defaults, and the only // way to start with a clean slate is to retrieve all methods, disallow // them all, and then set the ones we want to allow. $allow = new Allow(); $allMethods = $allow->getAllMethods(); $allow->disallowMethods(array_keys($allMethods)); $allow->allowMethods($methods); return $allow; }
public function testAllowChecksAllowedMethod() { $allowHeader = new Allow(); $allowHeader->allowMethods(array('GET', 'POST', 'TRACE')); $this->assertTrue($allowHeader->isAllowedMethod('TRACE')); }