/** * @param MutationCommand[] $commands * @param MutationTester $tester * @return bool */ private function findWorkingPermutations(array $commands, MutationTester $tester) { if (empty($commands)) { return false; } $lineToTest = $commands[0]; $lineToTest->execute(); if ($tester->isValid()) { return true; } $rest = array_slice($commands, 1); if ($this->findWorkingPermutations($rest, $tester)) { return true; } $lineToTest->undo(); return $this->findWorkingPermutations($rest, $tester); }
/** * @param $tester * @throws \Exception */ private function testPostcondition(MutationTester $tester) { if (!$tester->isValid()) { throw new \Exception("Tester did not reach a valid state after mutation"); } }