/**
  * @param $class
  * @param $proxyFactory
  * @param $testRunner
  * @param $mutator
  * @throws \Exception
  */
 private function calculateRealCoverage($class, ProxyFactory $proxyFactory, PHPUnitRunner $testRunner, Mutator $mutator)
 {
     $proxy = $proxyFactory->getProxy($class);
     $tester = new ProxiedMutationTester($proxy, $class, $testRunner);
     $this->testPrecondition($tester);
     $mutator->testMutations($tester, new MutationGenerator($class));
     $proxy->loadClass($class);
     $this->testPostcondition($tester);
 }
 public function testMutatorFindsLinesThatAreOnlyNeccessaryWhenAFollowingOneExists()
 {
     $line0 = new CoveredLine('$c=0;');
     $line0->addCoverage("");
     $line1 = new CoveredLine('$c++;');
     $line1->addCoverage("");
     $this->assertTrue($line0->isEnabled());
     $this->assertTrue($line1->isEnabled());
     $class = $this->mockClass(array($line0, $line1));
     $generator = new MutationGenerator($class);
     //tester will only validate if everything is enabled or line1 AND line3 are disabled
     $validatorCallback = function () use($line0, $line1) {
         if ($line0->isEnabled()) {
             return true;
         }
         return !$line1->isEnabled();
         // line0 enabled or both disabled
     };
     $tester = $this->mockTester($validatorCallback);
     $mutator = new Mutator();
     $mutator->testMutations($tester, $generator);
     $this->assertFalse($line0->isEnabled());
     $this->assertFalse($line1->isEnabled());
 }