Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
AbstractHeaderTestCase.php
Go to the documentation of this file.
1 <?php
7 
9 {
11  private $interceptedResponse;
12 
13  public function setUp()
14  {
15  parent::setUp();
16  $this->_objectManager->configure(
17  [
18  'preferences' =>
19  [
20  \Magento\Framework\App\Response\Http::class =>
21  \Magento\Framework\App\Response\Http\Interceptor::class
22  ]
23  ]
24  );
25  $this->interceptedResponse = $this->_objectManager->create(\Magento\Framework\App\Response\Http::class);
26  }
27 
34  protected function assertHeaderPresent($name, $value)
35  {
36  $this->interceptedResponse->sendResponse();
37 
38  $header = $this->interceptedResponse->getHeader($name);
39  $this->assertTrue(is_subclass_of($header, \Zend\Http\Header\HeaderInterface::class, false));
40  $this->assertSame(
41  $value,
42  $header->getFieldValue()
43  );
44  }
45 
46  protected function assertHeaderNotPresent($name)
47  {
48  $this->interceptedResponse->sendResponse();
49  $this->assertFalse($this->interceptedResponse->getHeader($name));
50  }
51 }
is_subclass_of($obj, $className)
$value
Definition: gender.phtml:16
if(!isset($_GET['name'])) $name
Definition: log.php:14