Sanpi\Behatch\Context\SystemContext::outputShouldContain PHP Method

outputShouldContain() public method

Checks, that output contains specified text.
public outputShouldContain ( $text )
    public function outputShouldContain($text)
    {
        $regex = '~' . $text . '~ui';
        $check = false;
        foreach ($this->output as $line) {
            if (preg_match($regex, $line) === 1) {
                $check = true;
                break;
            }
        }
        if ($check === false) {
            throw new \Exception(sprintf("The text '%s' was not found anywhere on output of command.\n%s", $text, implode("\n", $this->output)));
        }
    }