Pantheon\Terminus\FeatureTests\FeatureContext::shouldSeeATypeOfMessage PHP Method

shouldSeeATypeOfMessage() public method

Checks the output for a type of message. Message to match is optional.
public shouldSeeATypeOfMessage ( $type, $message = null ) : boolean
$type string One of the standard logging levels
$message string Optional message to match in the output
return boolean True if message is the correct type and exists in output if given
    public function shouldSeeATypeOfMessage($type, $message = null)
    {
        $expected_message = "[{$type}]";
        if (!empty($message)) {
            $expected_message .= " {$message}";
        }
        $compressed_output = preg_replace('/\\s+/', ' ', $this->output);
        if (strpos($compressed_output, $expected_message) === false) {
            throw new \Exception("Expected {$expected_message} in message: {$this->output}");
        }
        return true;
    }