예제 #1
0
 /**
  * Checks if a specified http header is existing
  *
  * @see LiveTest\TestCase.HttpTestCase::test()
  */
 public function test(Response $response, Request $request)
 {
     $header = $response->getHeader();
     if (!$header->hasField($this->headerName)) {
         throw new Exception('The expected header "' . $this->headerName . '" was not found.');
     }
 }
예제 #2
0
 /**
  * Checks for given directives in the cache control header
  *
  * @param Response $response
  *            recieved response
  * @param Request $request
  *            request we sent
  */
 public function test(Response $response, Request $request)
 {
     $header = $response->getHeader();
     $missing = array();
     foreach ($this->values as $value) {
         if (!$header->hasField($this->fieldName) && !$header->getField($this->fieldName) == $value) {
             $missing[] = $value;
         }
     }
     if (!empty($missing)) {
         throw new Exception("Expected header fields not set correct \"" . implode(', ', $missing) . ")");
     }
 }
 /**
  * Checks for given directives in the cache control header
  *
  * @param Response $response
  *            recieved response
  * @param Request $request
  *            request we sent
  */
 public function test(Response $response, Request $request)
 {
     $header = $response->getHeader();
     $missing = array();
     foreach ($this->directives as $directive) {
         if (!$header->directiveExists(self::FIELD_NAME, $directive)) {
             $missing[] = $directive;
         }
     }
     if (!empty($missing)) {
         throw new Exception("Expected cache directives \"" . implode(', ', $missing) . "\" not found in response header field " . self::FIELD_NAME);
     }
 }