/**
  * @param string $testFile
  */
 public function endTest($testFile)
 {
     $files = array_keys($this->driver->stopCodeCoverage());
     foreach ($files as $file) {
         if (!$this->isIgnored($file)) {
             $this->cache->add($file, $testFile);
         }
     }
 }
예제 #2
0
 public function test_remove_cache_if_files_do_not_exist()
 {
     $arg = 'src/Calc.php';
     $related_tests = ['tests/BankAccountTest.php', 'tests/CalcTest.php'];
     $this->cache->get($arg)->shouldBeCalled()->willReturn($related_tests);
     $this->cache->remove('src/Calc.php', 'tests/BankAccountTest.php')->shouldBeCalled();
     $this->fs->saveCache($this->cache)->shouldBeCalled();
     $this->fs->cacheDir()->willReturn('.smartrunner');
     $this->fs->fileExists('tests/BankAccountTest.php')->willReturn(false);
     $this->fs->fileExists('tests/CalcTest.php')->willReturn(true);
     $this->fs->saveSuiteFile(['tests/CalcTest.php'])->shouldBeCalled();
     $this->command->run([$arg]);
 }
예제 #3
0
 public function test_paths_are_converted_to_relative_path()
 {
     $cache = new Cache($this->fs);
     $cache->add($this->root->url() . '/foo', $this->root->url() . '/bar');
     $this->assertEquals(['bar'], $cache->get('foo'));
 }