diff --git a/build/integration/features/bootstrap/CommandLine.php b/build/integration/features/bootstrap/CommandLine.php index 4694102501..b34005fdad 100644 --- a/build/integration/features/bootstrap/CommandLine.php +++ b/build/integration/features/bootstrap/CommandLine.php @@ -23,6 +23,8 @@ * */ +use PHPUnit\Framework\Assert; + require __DIR__ . '/../../vendor/autoload.php'; trait CommandLine { @@ -95,25 +97,6 @@ trait CommandLine { return $exceptions; } - /** - * Finds all lines containing the given text - * - * @param string $input stdout or stderr output - * @param string $text text to search for - * @return array array of lines that matched - */ - public function findLines($input, $text) { - $results = []; - // the exception text usually appears after an "[Exception"] row - foreach (explode("\n", $input) as $line) { - if (strpos($line, $text) !== false) { - $results[] = $line; - } - } - - return $results; - } - /** * @Then /^the command was successful$/ */ @@ -158,19 +141,13 @@ trait CommandLine { * @Then /^the command output contains the text "([^"]*)"$/ */ public function theCommandOutputContainsTheText($text) { - $lines = $this->findLines($this->lastStdOut, $text); - if (empty($lines)) { - throw new \Exception('The command did not output the expected text on stdout "' . $text . '"'); - } + Assert::assertContains($text, $this->lastStdOut, 'The command did not output the expected text on stdout'); } /** * @Then /^the command error output contains the text "([^"]*)"$/ */ public function theCommandErrorOutputContainsTheText($text) { - $lines = $this->findLines($this->lastStdErr, $text); - if (empty($lines)) { - throw new \Exception('The command did not output the expected text on stderr "' . $text . '"'); - } + Assert::assertContains($text, $this->lastStdErr, 'The command did not output the expected text on stderr'); } }