-
-
Notifications
You must be signed in to change notification settings - Fork 154
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Enhancement: Implement ArgumentRemovalArrayReplace mutator #565
Enhancement: Implement ArgumentRemovalArrayReplace mutator #565
Conversation
When I add the following test case diff --git a/tests/Mutator/ArgumentRemoval/ArgumentRemovalArrayReplaceTest.php b/tests/Mutator/ArgumentRemoval/ArgumentRemovalArrayReplaceTest.php
index 69f96d2..b542f13 100644
--- a/tests/Mutator/ArgumentRemoval/ArgumentRemovalArrayReplaceTest.php
+++ b/tests/Mutator/ArgumentRemoval/ArgumentRemovalArrayReplaceTest.php
@@ -141,6 +141,29 @@ PHP
],
];
+ yield 'It mutates correctly when there is a backslash in front of array_replace' => [
+ <<<'PHP'
+<?php
+
+$a = \array_replace(['A', 1, 'C'], ['D']);
+PHP
+ ,
+ [
+ <<<'PHP'
+<?php
+
+$a = \array_replace(['D']);
+PHP
+ ,
+ <<<'PHP'
+<?php
+
+$a = \array_replace(['A', 1, 'C']);
+PHP
+ ,
+ ],
+ ];
+
yield 'It mutates correctly when array_replace uses constants as input' => [
<<<'PHP'
<?php and run
then the tests pass, but warnings are emitted:
Does anyone have an idea how to sort this out? |
ASCII 7 aka Bell sneaked through somewhere? |
Yes, right here:
|
Well, that bit just checks if a test contains a valid PHP code. It is somewhere in |
d54e37e
to
0d22be3
Compare
What do you think about Copied and adjusted from the examples at http://php.net/proc_open. |
05639f3
to
627096f
Compare
It should be more like this: #301 (comment) Though I'm not entirely sure everything is in order there (proc_open is a bit tricky about closed-read pipes). So I'd make a separate function, and a test for it with a known invalid code. static function isCodeValid($code) { ... }
function test_is_code_valid_sees_invalid_code() { $this->assertFalse(self::isCodeValid('<?php invalid=1')); }
function assertCodeValid($code) { $this->assertTrue(self::isCodeValid($code)); } Original argument in #301 against |
627096f
to
f57a729
Compare
f57a729
to
e37f0f6
Compare
This PR
ArgumentRemovalArrayReplace
mutatorRelated to #537.