diff --git a/README.md b/README.md index 45d6787..07776cc 100644 --- a/README.md +++ b/README.md @@ -451,6 +451,9 @@ Humbug implements a basic suite of Mutators, which essentially tells us when a particular PHP token can be mutated, and also apply that mutation to an array of tokens. +Note: Source code held within functions (rather than class methods) is not mutated +at this time. + Binary Arithmetic: | Original | Mutated | Original | Mutated | diff --git a/features/bootstrap/FeatureContext.php b/features/bootstrap/FeatureContext.php index c15b3b2..3d270ec 100644 --- a/features/bootstrap/FeatureContext.php +++ b/features/bootstrap/FeatureContext.php @@ -106,7 +106,7 @@ public function iShouldSee(PyStringNode $string) */ public function iShouldSeeContaining(PyStringNode $string) { - if (!preg_match('/' . preg_quote((string) $string) . '/', $this->appTester->getDisplay())) { + if (!preg_match('/' . preg_quote((string) $string, '/') . '/', $this->appTester->getDisplay())) { throw new \RuntimeException(sprintf( 'Output did not match expected pattern:%s%s', PHP_EOL, $this->appTester->getDisplay() )); diff --git a/features/running/developer_sees_mutant_error_result.feature b/features/running/developer_sees_mutant_error_result.feature index a51782f..ce99238 100644 --- a/features/running/developer_sees_mutant_error_result.feature +++ b/features/running/developer_sees_mutant_error_result.feature @@ -24,7 +24,7 @@ Feature: Use Humbug $foo = new Foo; $r = $foo->add(2, 1); // emulate error - if ($r !== 3) $foo->bar(); + if ($r !== 3) require __DIR__ . '/this.does.not.exist.xyz'; $this->assertEquals(3, $r); } } diff --git a/features/version.feature b/features/version.feature index 315ab0c..fc21ad8 100644 --- a/features/version.feature +++ b/features/version.feature @@ -6,7 +6,7 @@ Feature: Developer runs Humbug with --version option Scenario: View Humbug version Given I am in any directory When I run humbug with "--version" - Then I should see: + Then I should see output containing: """ _ _ _ | || |_ _ _ __ | |__ _ _ __ _ diff --git a/src/Mutable.php b/src/Mutable.php index 4b9b8d8..1e20b86 100644 --- a/src/Mutable.php +++ b/src/Mutable.php @@ -146,7 +146,7 @@ public function generate() } //TODO: handle whitespace! - if (is_array($token) && $token[0] == T_FUNCTION) { + if (is_array($token) && $token[0] == T_FUNCTION && '???' !== $className) { if (!isset($tokens[$index+2][1])) { continue; // ignore closure }