/** * Run the tests on a table * * @param string $table * @param Result $records * * @return array */ protected function runTests($table, Result $records) { System::loadLanguageFile('seo_serp_tests'); $result = ['errors' => 0, 'warnings' => 0]; /** @var TestInterface $test */ foreach (TestsManager::getAll() as $test) { // Skip the unsupported tests if (!$test->supports($table)) { continue; } while ($records->next()) { try { $test->run($records->row(), $table); } catch (ErrorException $e) { $result['errors']++; } catch (WarningException $e) { $result['warnings']++; } } $records->reset(); } return $result; }