/**
  * Run the tests
  *
  * @param string $table
  * @param array  $data
  *
  * @throws ErrorException
  * @throws WarningException
  */
 protected function runTests($table, array $data)
 {
     /** @var TestInterface $test */
     foreach (TestsManager::getAll() as $test) {
         if (!$test->supports($table)) {
             continue;
         }
         $test->run($data, $table);
     }
 }
 /**
  * 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;
 }
 /**
  * Generate the tests for a record
  *
  * @param array $data
  *
  * @return array
  */
 protected function generateTests(array $data)
 {
     System::loadLanguageFile('seo_serp_tests');
     $result = ['errors' => [], 'warnings' => []];
     /** @var TestInterface $test */
     foreach (TestsManager::getAll() as $test) {
         // Skip the unsupported tests
         if (!$test->supports($this->table)) {
             continue;
         }
         try {
             $test->run($data, $this->table);
         } catch (ErrorException $e) {
             $result['errors'][] = $e->getMessage();
         } catch (WarningException $e) {
             $result['warnings'][] = $e->getMessage();
         }
     }
     return $result;
 }