function __construct($runner, $name, $fileName)
 {
     parent::__construct($name);
     $this->ptRunner = $runner;
     $this->ptFileName = $fileName;
     $this->ptFileInfo = TestFileReader::read($this->ptFileName);
     foreach ($this->ptFileInfo['tests'] as $test) {
         $this->addTest(new ParserIntegrationTest($runner, $fileName, $test), ['Database', 'Parser', 'ParserTests']);
     }
 }
Example #2
0
 /**
  * Run a series of tests listed in the given text files.
  * Each test consists of a brief description, wikitext input,
  * and the expected HTML output.
  *
  * Prints status updates on stdout and counts up the total
  * number and percentage of passed tests.
  *
  * Handles all setup and teardown.
  *
  * @param array $filenames Array of strings
  * @return bool True if passed all tests, false if any tests failed.
  */
 public function runTestsFromFiles($filenames)
 {
     $ok = false;
     $teardownGuard = $this->staticSetup();
     $teardownGuard = $this->setupDatabase($teardownGuard);
     $teardownGuard = $this->setupUploads($teardownGuard);
     $this->recorder->start();
     try {
         $ok = true;
         foreach ($filenames as $filename) {
             $testFileInfo = TestFileReader::read($filename, ['runDisabled' => $this->runDisabled, 'runParsoid' => $this->runParsoid, 'regex' => $this->regex]);
             // Don't start the suite if there are no enabled tests in the file
             if (!$testFileInfo['tests']) {
                 continue;
             }
             $this->recorder->startSuite($filename);
             $ok = $this->runTests($testFileInfo) && $ok;
             $this->recorder->endSuite($filename);
         }
         $this->recorder->report();
     } catch (DBError $e) {
         $this->recorder->warning($e->getMessage());
     }
     $this->recorder->end();
     ScopedCallback::consume($teardownGuard);
     return $ok;
 }