public function testSimpleEngineIncremental() { // old errors are not reported in incremental mode, // even if the line numbers are changed $lint_engine = new XRef_LintEngine_Simple($this->xref, false); $file_provider1 = new XRef_FileProvider_InMemory(array('fileA.php' => '<?php echo $bar;')); $file_provider2 = new XRef_FileProvider_InMemory(array('fileA.php' => '<?php echo $bar;')); $report = $lint_engine->getIncrementalReport($file_provider1, $file_provider2, array("fileA.php")); $this->assertTrue(count($report) == 0); // new errors in the same file are reported $lint_engine = new XRef_LintEngine_Simple($this->xref, false); $file_provider1 = new XRef_FileProvider_InMemory(array('fileA.php' => '<?php echo $bar;')); $file_provider2 = new XRef_FileProvider_InMemory(array('fileA.php' => '<?php echo $bar; // not reported echo $foo; // new error ')); $report = $lint_engine->getIncrementalReport($file_provider1, $file_provider2, array("fileA.php")); $this->assertTrue(count($report) == 1); $this->assertTrue(isset($report["fileA.php"])); $this->assertTrue(count($report["fileA.php"]) == 1); $this->assertTrue($report["fileA.php"][0]->tokenText == '$foo'); // all errors in new files are reported $lint_engine = new XRef_LintEngine_Simple($this->xref, false); $file_provider1 = new XRef_FileProvider_InMemory(array('fileA.php' => '<?php echo $bar;')); $file_provider2 = new XRef_FileProvider_InMemory(array('fileA.php' => '<?php echo $bar; // not reported echo $foo; // new error ', 'fileB.php' => '<?php echo $qux;')); $report = $lint_engine->getIncrementalReport($file_provider1, $file_provider2, array("fileA.php", 'fileB.php')); $this->assertTrue(count($report) == 2); $this->assertTrue(isset($report["fileA.php"])); $this->assertTrue(isset($report["fileB.php"])); $this->assertTrue(count($report["fileA.php"]) == 1); $this->assertTrue(count($report["fileB.php"]) == 1); $this->assertTrue($report["fileA.php"][0]->tokenText == '$foo'); $this->assertTrue($report["fileB.php"][0]->tokenText == '$qux'); }