/** * 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 testAllowListAllDefinedMethods() { $methods = array('OPTIONS' => false, 'GET' => true, 'HEAD' => false, 'POST' => true, 'PUT' => false, 'DELETE' => false, 'TRACE' => false, 'CONNECT' => false, 'PATCH' => false); $allowHeader = new Allow(); $this->assertEquals($methods, $allowHeader->getAllMethods()); }