Пример #1
0
 public function test__toString()
 {
     $skipHeadersTest = headers_sent();
     $this->_response->setHeader('Content-Type', 'text/plain');
     $this->_response->setBody('Content');
     $this->_response->appendBody('; and more content.');
     $expected = 'Content; and more content.';
     $result = $this->_response->__toString();
     if (!$skipHeadersTest) {
         $this->assertTrue(headers_sent());
         $headers = headers_list();
         $found = false;
         foreach ($headers as $header) {
             if ('Content-Type: text/plain' == $header) {
                 $found = true;
             }
         }
         $this->assertTrue($found, var_export($headers, 1));
     }
 }
Пример #2
0
 public function testHeaderNamesAreCaseInsensitive()
 {
     $this->_response->setHeader('X-Foo_Bar-Baz', 'value');
     $this->_response->setHeader('X-FOO_bar-bAz', 'bat');
     $headers = $this->_response->getHeaders();
     $names = array();
     foreach ($headers as $header) {
         $names[] = $header['name'];
     }
     $this->assertTrue(in_array('X-Foo-Bar-Baz', $names), var_export($headers, 1));
     $this->assertFalse(in_array('X-Foo_Bar-Baz', $names));
     $this->assertFalse(in_array('X-FOO_bar-bAz', $names));
 }