src/Assertions/AssertHeader.php
/**
     * Called when a test failed.
     *
     * @since 1.1.0
     *
     * @param PageResultInterface $pageResult The page result.
     *
     * @return string The error text.
     */
Called when a test failed.

@param PageResultInterface $pageResult The page result.

@return string The error text.
Called when a test failed . @param PageResultInterface $pageResult The page result . @return string The error text .
protected function onFail(PageResultInterface $pageResult): string
    {
        $headerString = implode(
            ', ',
            array_map(function (string $s) {
                return '"' . $s . '"';
            }, $pageResult->getHeaders())
        );
        if ($headerString === '') {
            $headerString = '""';
        }
        $result = 'Headers ' . $headerString . ' ' . ($this->getModifiers()->isNot() ? 'contains' : 'does not contain') . ' a header with name "' . $this->headerName . '"';
        if ($this->headerValue !== null) {
            $result .= ' and value "' . $this->headerValue . '"';
        }
        return $result;
    }
protected function onFail ( PageResultInterface $ pageResult ) : string { $ headerString = implode ( ', ' , array_map ( function ( string $ s ) { return '"' . $ s . '"' ; } , $ pageResult -> getHeaders ( ) ) ) ; if ( $ headerString === '' ) { $ headerString = '""' ; } $ result = 'Headers ' . $ headerString . ' ' . ( $ this -> getModifiers ( ) -> isNot ( ) ? 'contains' : 'does not contain' ) . ' a header with name "' . $ this -> headerName . '"' ; if ( $ this -> headerValue !== null ) { $ result .= ' and value "' . $ this -> headerValue . '"' ; } return $ result ; }
Called when a test failed.
Called when a test failed .