'loadErrorCountsBeforeSuite', Events::TEST_AFTER => 'checkErrorsAfterTest', Events::SUITE_AFTER => 'processErrorsAfterSuite', ]; function loadErrorCountsBeforeSuite() { foreach (self::ERROR_LOG_PATHS as $path) { $this->known_error_counts[$path] = count($this->readFileToArray($path)); } } function checkErrorsAfterTest(TestEvent $e) { foreach (self::ERROR_LOG_PATHS as $path) { $errors = $this->readFileToArray($path); foreach (array_slice($errors, $this->known_error_counts[$path]) as $error) { $this->output->writeln("$error"); $this->errors[] = [$e->getTest(), new AssertionFailedError($error)]; $this->known_error_counts[$path]++; } } } function processErrorsAfterSuite(SuiteEvent $event) { foreach ($this->errors as $error) { list($test, $exception) = $error; $event->getResult()->addFailure($test, $exception, microtime(true)); } } private function readFileToArray($path) { return file_exists($path) ? file($path, FILE_IGNORE_NEW_LINES | FILE_SKIP_EMPTY_LINES) : []; } }