예제 #1
0
 /**
  * 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;
 }
예제 #2
0
파일: AllowTest.php 프로젝트: nieldm/zf2
 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());
 }