Phalcon\Test\FunctionalTestCase::assertHeader PHP Method

assertHeader() public method

Assert that the response headers contains the given array $expected = ['Content-Type' => 'application/json']
public assertHeader ( array $expected )
$expected array The expected headers
    public function assertHeader(array $expected)
    {
        foreach ($expected as $expectedField => $expectedValue) {
            $actualValue = $this->di->getShared('response')->getHeaders()->get($expectedField);
            if ($actualValue != $expectedValue) {
                throw new \PHPUnit_Framework_ExpectationFailedException(sprintf('Failed asserting "%s" has a value of "%s", actual "%s" header value is "%s"', $expectedField, $expectedValue, $expectedField, $actualValue));
            }
            $this->assertEquals($expectedValue, $actualValue);
        }
    }