From 3b5b4b585fb6a8383378381dd888d469932cfb37 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andreas=20M=C3=B6ller?= Date: Sun, 17 Feb 2019 13:01:07 +0100 Subject: [PATCH 1/8] Enhancement: Implement UnwrapTrim mutator (#638) --- src/Mutator/Unwrap/UnwrapTrim.php | 54 +++++++ src/Mutator/Util/MutatorProfile.php | 2 + tests/Mutator/Unwrap/UnwrapTrimTest.php | 192 ++++++++++++++++++++++++ 3 files changed, 248 insertions(+) create mode 100644 src/Mutator/Unwrap/UnwrapTrim.php create mode 100644 tests/Mutator/Unwrap/UnwrapTrimTest.php diff --git a/src/Mutator/Unwrap/UnwrapTrim.php b/src/Mutator/Unwrap/UnwrapTrim.php new file mode 100644 index 0000000000..4943496fa8 --- /dev/null +++ b/src/Mutator/Unwrap/UnwrapTrim.php @@ -0,0 +1,54 @@ + Mutator\Unwrap\UnwrapStrRepeat::class, 'UnwrapStrToLower' => Mutator\Unwrap\UnwrapStrToLower::class, 'UnwrapStrToUpper' => Mutator\Unwrap\UnwrapStrToUpper::class, + 'UnwrapTrim' => Mutator\Unwrap\UnwrapTrim::class, 'UnwrapUcFirst' => Mutator\Unwrap\UnwrapUcFirst::class, ]; } diff --git a/tests/Mutator/Unwrap/UnwrapTrimTest.php b/tests/Mutator/Unwrap/UnwrapTrimTest.php new file mode 100644 index 0000000000..0322373c80 --- /dev/null +++ b/tests/Mutator/Unwrap/UnwrapTrimTest.php @@ -0,0 +1,192 @@ +doTest($input, $expected); + } + + public function provideMutationCases(): \Generator + { + yield 'It mutates correctly when provided with a string' => [ + <<<'PHP' + [ + <<<'PHP' + [ + <<<'PHP' + [ + <<<'PHP' + [ + <<<'PHP' + [ + <<<'PHP' +bar()); +PHP + , + <<<'PHP' +bar(); +PHP + ]; + + yield 'It mutates correctly when provided with a more complex situation' => [ + <<<'PHP' + [ + <<<'PHP' + [ + <<<'PHP' + [ + <<<'PHP' + Date: Sun, 17 Feb 2019 16:06:47 +0100 Subject: [PATCH 2/8] Enhancement: Implement UnwrapArrayUintersectUassoc mutator (#633) --- .../Unwrap/UnwrapArrayUintersectUassoc.php | 58 ++++ src/Mutator/Util/MutatorProfile.php | 2 + .../UnwrapArrayUintersectUassocTest.php | 282 ++++++++++++++++++ 3 files changed, 342 insertions(+) create mode 100644 src/Mutator/Unwrap/UnwrapArrayUintersectUassoc.php create mode 100644 tests/Mutator/Unwrap/UnwrapArrayUintersectUassocTest.php diff --git a/src/Mutator/Unwrap/UnwrapArrayUintersectUassoc.php b/src/Mutator/Unwrap/UnwrapArrayUintersectUassoc.php new file mode 100644 index 0000000000..03c4eaaab5 --- /dev/null +++ b/src/Mutator/Unwrap/UnwrapArrayUintersectUassoc.php @@ -0,0 +1,58 @@ +args), + 0, + \count($node->args) - 2 + ); + } +} diff --git a/src/Mutator/Util/MutatorProfile.php b/src/Mutator/Util/MutatorProfile.php index 1ccafb00e2..f3f6587968 100644 --- a/src/Mutator/Util/MutatorProfile.php +++ b/src/Mutator/Util/MutatorProfile.php @@ -217,6 +217,7 @@ final class MutatorProfile Mutator\Unwrap\UnwrapArrayUdiffAssoc::class, Mutator\Unwrap\UnwrapArrayUdiffUassoc::class, Mutator\Unwrap\UnwrapArrayUintersectAssoc::class, + Mutator\Unwrap\UnwrapArrayUintersectUassoc::class, Mutator\Unwrap\UnwrapArrayUnique::class, Mutator\Unwrap\UnwrapArrayValues::class, Mutator\Unwrap\UnwrapStrRepeat::class, @@ -376,6 +377,7 @@ final class MutatorProfile 'UnwrapArrayUdiffAssoc' => Mutator\Unwrap\UnwrapArrayUdiffAssoc::class, 'UnwrapArrayUdiffUassoc' => Mutator\Unwrap\UnwrapArrayUdiffUassoc::class, 'UnwrapArrayUintersectAssoc' => Mutator\Unwrap\UnwrapArrayUintersectAssoc::class, + 'UnwrapArrayUintersectUassoc' => Mutator\Unwrap\UnwrapArrayUintersectUassoc::class, 'UnwrapArrayUnique' => Mutator\Unwrap\UnwrapArrayUnique::class, 'UnwrapArrayValues' => Mutator\Unwrap\UnwrapArrayValues::class, 'UnwrapStrRepeat' => Mutator\Unwrap\UnwrapStrRepeat::class, diff --git a/tests/Mutator/Unwrap/UnwrapArrayUintersectUassocTest.php b/tests/Mutator/Unwrap/UnwrapArrayUintersectUassocTest.php new file mode 100644 index 0000000000..7961df77dd --- /dev/null +++ b/tests/Mutator/Unwrap/UnwrapArrayUintersectUassocTest.php @@ -0,0 +1,282 @@ +doTest($input, $expected); + } + + public function provideMutationCases(): \Generator + { + yield 'It mutates correctly when provided with an array' => [ + <<<'PHP' + 'bar'], ['baz' => 'bar'], $valueCompareFunc, $keyCompareFunc); +PHP + , + [ + <<<'PHP' + 'bar']; +PHP + , + <<<'PHP' + 'bar']; +PHP + , + ], + ]; + + yield 'It mutates correctly when provided with a constant' => [ + <<<'PHP' + 'bar'], $valueCompareFunc, $keyCompareFunc); +PHP + , + [ + <<<'PHP' + 'bar']; +PHP + , + ], + ]; + + yield 'It mutates correctly when a backslash is in front of array_uintersect_uassoc' => [ + <<<'PHP' + 'bar'], ['baz' => 'bar'], $valueCompareFunc, $keyCompareFunc); +PHP + , + [ + <<<'PHP' + 'bar']; +PHP + , + <<<'PHP' + 'bar']; +PHP + , + ], + ]; + + yield 'It mutates correctly within if statements' => [ + <<<'PHP' + 'bar']; +if (array_uintersect_uassoc($a, ['baz' => 'bar'], $valueCompareFunc, $keyCompareFunc) === $a) { + return true; +} +PHP + , + [ + <<<'PHP' + 'bar']; +if ($a === $a) { + return true; +} +PHP + , + <<<'PHP' + 'bar']; +if (['baz' => 'bar'] === $a) { + return true; +} +PHP + , + ], + ]; + + yield 'It mutates correctly when array_uintersect_uassoc is wrongly capitalized' => [ + <<<'PHP' + 'bar'], ['baz' => 'bar'], $valueCompareFunc, $keyCompareFunc); +PHP + , + [ + <<<'PHP' + 'bar']; +PHP + , + <<<'PHP' + 'bar']; +PHP + , + ], + ]; + + yield 'It mutates correctly when array_uintersect_uassoc uses functions as input' => [ + <<<'PHP' +bar(), $foo->baz(), $valueCompareFunc, $keyCompareFunc); +PHP + , + [ + <<<'PHP' +bar(); +PHP + , + <<<'PHP' +baz(); +PHP + , + ], + ]; + + yield 'It mutates correctly when provided with a more complex situation' => [ + <<<'PHP' + 'bar'], ['baz' => 'bar'], $valueCompareFunc, $keyCompareFunc)); +PHP + , + [ + <<<'PHP' + 'bar']); +PHP + , + <<<'PHP' + 'bar']); +PHP + , + ], + ]; + + yield 'It mutates correctly when more than two parameters are present' => [ + <<<'PHP' + 'bar'], ['baz' => 'bar'], ['qux' => 'bar'], $valueCompareFunc, $keyCompareFunc); +PHP + , + [ + <<<'PHP' + 'bar']; +PHP + , + <<<'PHP' + 'bar']; +PHP + , + <<<'PHP' + 'bar']; +PHP + , + ], + ]; + + yield 'It does not mutate other array_ calls' => [ + <<<'PHP' + 'bar']); +PHP + ]; + + yield 'It does not mutate functions named array_uintersect_uassoc' => [ + <<<'PHP' + [ + <<<'PHP' + 'bar'], ['baz' => 'bar'], $valueCompareFunc, $keyCompareFunc); +PHP + ]; + } +} From ed9f12d7788f4c85d9a4e42e01500612393a47cf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andreas=20M=C3=B6ller?= Date: Sun, 17 Feb 2019 20:39:41 +0100 Subject: [PATCH 3/8] Enhancement: Implement UnwrapArrayUintersect mutator (#637) --- src/Mutator/Unwrap/UnwrapArrayUintersect.php | 58 ++++ src/Mutator/Util/MutatorProfile.php | 2 + .../Unwrap/UnwrapArrayUintersectTest.php | 282 ++++++++++++++++++ 3 files changed, 342 insertions(+) create mode 100644 src/Mutator/Unwrap/UnwrapArrayUintersect.php create mode 100644 tests/Mutator/Unwrap/UnwrapArrayUintersectTest.php diff --git a/src/Mutator/Unwrap/UnwrapArrayUintersect.php b/src/Mutator/Unwrap/UnwrapArrayUintersect.php new file mode 100644 index 0000000000..b3574ca6a9 --- /dev/null +++ b/src/Mutator/Unwrap/UnwrapArrayUintersect.php @@ -0,0 +1,58 @@ +args), + 0, + \count($node->args) - 1 + ); + } +} diff --git a/src/Mutator/Util/MutatorProfile.php b/src/Mutator/Util/MutatorProfile.php index f3f6587968..aadb367a54 100644 --- a/src/Mutator/Util/MutatorProfile.php +++ b/src/Mutator/Util/MutatorProfile.php @@ -216,6 +216,7 @@ final class MutatorProfile Mutator\Unwrap\UnwrapArrayUdiff::class, Mutator\Unwrap\UnwrapArrayUdiffAssoc::class, Mutator\Unwrap\UnwrapArrayUdiffUassoc::class, + Mutator\Unwrap\UnwrapArrayUintersect::class, Mutator\Unwrap\UnwrapArrayUintersectAssoc::class, Mutator\Unwrap\UnwrapArrayUintersectUassoc::class, Mutator\Unwrap\UnwrapArrayUnique::class, @@ -376,6 +377,7 @@ final class MutatorProfile 'UnwrapArrayUdiff' => Mutator\Unwrap\UnwrapArrayUdiff::class, 'UnwrapArrayUdiffAssoc' => Mutator\Unwrap\UnwrapArrayUdiffAssoc::class, 'UnwrapArrayUdiffUassoc' => Mutator\Unwrap\UnwrapArrayUdiffUassoc::class, + 'UnwrapArrayUintersect' => Mutator\Unwrap\UnwrapArrayUintersect::class, 'UnwrapArrayUintersectAssoc' => Mutator\Unwrap\UnwrapArrayUintersectAssoc::class, 'UnwrapArrayUintersectUassoc' => Mutator\Unwrap\UnwrapArrayUintersectUassoc::class, 'UnwrapArrayUnique' => Mutator\Unwrap\UnwrapArrayUnique::class, diff --git a/tests/Mutator/Unwrap/UnwrapArrayUintersectTest.php b/tests/Mutator/Unwrap/UnwrapArrayUintersectTest.php new file mode 100644 index 0000000000..a5cde7a659 --- /dev/null +++ b/tests/Mutator/Unwrap/UnwrapArrayUintersectTest.php @@ -0,0 +1,282 @@ +doTest($input, $expected); + } + + public function provideMutationCases(): \Generator + { + yield 'It mutates correctly when provided with an array' => [ + <<<'PHP' + 'bar'], ['baz' => 'bar'], $valueCompareFunc); +PHP + , + [ + <<<'PHP' + 'bar']; +PHP + , + <<<'PHP' + 'bar']; +PHP + , + ], + ]; + + yield 'It mutates correctly when provided with a constant' => [ + <<<'PHP' + 'bar'], $valueCompareFunc); +PHP + , + [ + <<<'PHP' + 'bar']; +PHP + , + ], + ]; + + yield 'It mutates correctly when a backslash is in front of array_uintersect' => [ + <<<'PHP' + 'bar'], ['baz' => 'bar'], $valueCompareFunc); +PHP + , + [ + <<<'PHP' + 'bar']; +PHP + , + <<<'PHP' + 'bar']; +PHP + , + ], + ]; + + yield 'It mutates correctly within if statements' => [ + <<<'PHP' + 'bar']; +if (array_uintersect($a, ['baz' => 'bar'], $valueCompareFunc) === $a) { + return true; +} +PHP + , + [ + <<<'PHP' + 'bar']; +if ($a === $a) { + return true; +} +PHP + , + <<<'PHP' + 'bar']; +if (['baz' => 'bar'] === $a) { + return true; +} +PHP + , + ], + ]; + + yield 'It mutates correctly when array_uintersect is wrongly capitalized' => [ + <<<'PHP' + 'bar'], ['baz' => 'bar'], $valueCompareFunc); +PHP + , + [ + <<<'PHP' + 'bar']; +PHP + , + <<<'PHP' + 'bar']; +PHP + , + ], + ]; + + yield 'It mutates correctly when array_uintersect uses functions as input' => [ + <<<'PHP' +bar(), $foo->baz(), $valueCompareFunc); +PHP + , + [ + <<<'PHP' +bar(); +PHP + , + <<<'PHP' +baz(); +PHP + , + ], + ]; + + yield 'It mutates correctly when provided with a more complex situation' => [ + <<<'PHP' + 'bar'], ['baz' => 'bar'], $valueCompareFunc)); +PHP + , + [ + <<<'PHP' + 'bar']); +PHP + , + <<<'PHP' + 'bar']); +PHP + , + ], + ]; + + yield 'It mutates correctly when more than two parameters are present' => [ + <<<'PHP' + 'bar'], ['baz' => 'bar'], ['qux' => 'bar'], $valueCompareFunc); +PHP + , + [ + <<<'PHP' + 'bar']; +PHP + , + <<<'PHP' + 'bar']; +PHP + , + <<<'PHP' + 'bar']; +PHP + , + ], + ]; + + yield 'It does not mutate other array_ calls' => [ + <<<'PHP' + 'bar']); +PHP + ]; + + yield 'It does not mutate functions named array_uintersect' => [ + <<<'PHP' + [ + <<<'PHP' + 'bar'], ['baz' => 'bar'], $valueCompareFunc); +PHP + ]; + } +} From f4ea96096ce0c35652d58accdaac89274ad41d0d Mon Sep 17 00:00:00 2001 From: Pol Dellaiera Date: Mon, 18 Feb 2019 21:19:33 +0100 Subject: [PATCH 4/8] Issue #642: New unwrap mutator: lcfirst (#643) * Issue #642: New unwrap mutator: lcfirst * Issue #642: Tests for the new unwrap mutator lcfirst. --- src/Mutator/Unwrap/UnwrapLcFirst.php | 54 ++++++ src/Mutator/Util/MutatorProfile.php | 2 + tests/Mutator/Unwrap/UnwrapLcFirstTest.php | 184 +++++++++++++++++++++ 3 files changed, 240 insertions(+) create mode 100644 src/Mutator/Unwrap/UnwrapLcFirst.php create mode 100644 tests/Mutator/Unwrap/UnwrapLcFirstTest.php diff --git a/src/Mutator/Unwrap/UnwrapLcFirst.php b/src/Mutator/Unwrap/UnwrapLcFirst.php new file mode 100644 index 0000000000..4a8cf6eab0 --- /dev/null +++ b/src/Mutator/Unwrap/UnwrapLcFirst.php @@ -0,0 +1,54 @@ + Mutator\Unwrap\UnwrapArrayUintersectUassoc::class, 'UnwrapArrayUnique' => Mutator\Unwrap\UnwrapArrayUnique::class, 'UnwrapArrayValues' => Mutator\Unwrap\UnwrapArrayValues::class, + 'UnwrapLcFirst' => Mutator\Unwrap\UnwrapLcFirst::class, 'UnwrapStrRepeat' => Mutator\Unwrap\UnwrapStrRepeat::class, 'UnwrapStrToLower' => Mutator\Unwrap\UnwrapStrToLower::class, 'UnwrapStrToUpper' => Mutator\Unwrap\UnwrapStrToUpper::class, diff --git a/tests/Mutator/Unwrap/UnwrapLcFirstTest.php b/tests/Mutator/Unwrap/UnwrapLcFirstTest.php new file mode 100644 index 0000000000..953dc10ac4 --- /dev/null +++ b/tests/Mutator/Unwrap/UnwrapLcFirstTest.php @@ -0,0 +1,184 @@ +doTest($input, $expected); + } + + public function provideMutationCases(): \Generator + { + yield 'It mutates correctly when provided with a string' => [ + <<<'PHP' + [ + <<<'PHP' + [ + <<<'PHP' + [ + <<<'PHP' + [ + <<<'PHP' + [ + <<<'PHP' +bar()); +PHP + , + <<<'PHP' +bar(); +PHP + ]; + + yield 'It mutates correctly when provided with a more complex situation' => [ + <<<'PHP' + [ + <<<'PHP' + [ + <<<'PHP' + Date: Mon, 18 Feb 2019 23:33:37 +0300 Subject: [PATCH 5/8] Mutator: AssignCoalesce. Upgrade PHPParser to 4.2.1 (#641) * AssignCoalesce mutator. Upgrade PHPParser to 4.2.1 * Explicitly set ^4.2.1 version of nikic/php-parser * Add tests to check binary coalesce is not mutated by null assign coalesce mutator --- composer.json | 2 +- composer.lock | 20 ++-- src/Mutator/Operator/AssignCoalesce.php | 64 +++++++++++ src/Mutator/Util/MutatorProfile.php | 2 + tests/Mutator/Operator/AssignCoalesceTest.php | 106 ++++++++++++++++++ 5 files changed, 183 insertions(+), 11 deletions(-) create mode 100644 src/Mutator/Operator/AssignCoalesce.php create mode 100644 tests/Mutator/Operator/AssignCoalesceTest.php diff --git a/composer.json b/composer.json index 715e42074f..badab3e6bc 100644 --- a/composer.json +++ b/composer.json @@ -43,7 +43,7 @@ "ext-libxml": "*", "composer/xdebug-handler": "^1.3", "justinrainbow/json-schema": "^5.2", - "nikic/php-parser": "^4.1", + "nikic/php-parser": "^4.2.1", "ocramius/package-versions": "^1.2", "padraic/phar-updater": "^1.0.4", "pimple/pimple": "^3.2", diff --git a/composer.lock b/composer.lock index e707095d55..4b264c05a1 100644 --- a/composer.lock +++ b/composer.lock @@ -1,10 +1,10 @@ { "_readme": [ "This file locks the dependencies of your project to a known state", - "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", + "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file", "This file is @generated automatically" ], - "content-hash": "f0460d05acd2ab2a660492a273f482df", + "content-hash": "8af1f24b91068bfac1ba46b2a0fd55f8", "packages": [ { "name": "composer/ca-bundle", @@ -104,7 +104,7 @@ "Xdebug", "performance" ], - "time": "2018-08-31T19:20:00+00:00" + "time": "2018-08-31T19:07:57+00:00" }, { "name": "justinrainbow/json-schema", @@ -174,16 +174,16 @@ }, { "name": "nikic/php-parser", - "version": "v4.1.0", + "version": "v4.2.1", "source": { "type": "git", "url": "https://github.com/nikic/PHP-Parser.git", - "reference": "d0230c5c77a7e3cfa69446febf340978540958c0" + "reference": "5221f49a608808c1e4d436df32884cbc1b821ac0" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/nikic/PHP-Parser/zipball/d0230c5c77a7e3cfa69446febf340978540958c0", - "reference": "d0230c5c77a7e3cfa69446febf340978540958c0", + "url": "https://api.github.com/repos/nikic/PHP-Parser/zipball/5221f49a608808c1e4d436df32884cbc1b821ac0", + "reference": "5221f49a608808c1e4d436df32884cbc1b821ac0", "shasum": "" }, "require": { @@ -199,7 +199,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "4.1-dev" + "dev-master": "4.2-dev" } }, "autoload": { @@ -221,7 +221,7 @@ "parser", "php" ], - "time": "2018-10-10T09:24:14+00:00" + "time": "2019-02-16T20:54:15+00:00" }, { "name": "ocramius/package-versions", @@ -325,7 +325,7 @@ "homepage": "http://blog.astrumfutura.com" }, { - "name": "Théo Fidry", + "name": "Théo FIDRY", "email": "theo.fidry@gmail.com" } ], diff --git a/src/Mutator/Operator/AssignCoalesce.php b/src/Mutator/Operator/AssignCoalesce.php new file mode 100644 index 0000000000..5612379fc4 --- /dev/null +++ b/src/Mutator/Operator/AssignCoalesce.php @@ -0,0 +1,64 @@ +var, $node->expr, $node->getAttributes()); + } + + protected function mutatesNode(Node $node): bool + { + return $node instanceof Coalesce; + } +} diff --git a/src/Mutator/Util/MutatorProfile.php b/src/Mutator/Util/MutatorProfile.php index a97ca4cab5..0fec1c122b 100644 --- a/src/Mutator/Util/MutatorProfile.php +++ b/src/Mutator/Util/MutatorProfile.php @@ -144,6 +144,7 @@ final class MutatorProfile ]; public const OPERATOR = [ + Mutator\Operator\AssignCoalesce::class, Mutator\Operator\Break_::class, Mutator\Operator\Coalesce::class, Mutator\Operator\Continue_::class, @@ -313,6 +314,7 @@ final class MutatorProfile 'OneZeroFloat' => Mutator\Number\OneZeroFloat::class, //Operator + 'AssignCoalesce' => Mutator\Operator\AssignCoalesce::class, 'Break_' => Mutator\Operator\Break_::class, 'Continue_' => Mutator\Operator\Continue_::class, 'Throw_' => Mutator\Operator\Throw_::class, diff --git a/tests/Mutator/Operator/AssignCoalesceTest.php b/tests/Mutator/Operator/AssignCoalesceTest.php new file mode 100644 index 0000000000..929fc46c0f --- /dev/null +++ b/tests/Mutator/Operator/AssignCoalesceTest.php @@ -0,0 +1,106 @@ +doTest($input, $expected); + } + + public function provideMutationCases(): \Generator + { + yield 'Mutate coalesce when right part is a scalar value' => [ + <<<'PHP' + [ + <<<'PHP' + [ + <<<'PHP' + [ + <<<'PHP' + Date: Tue, 19 Feb 2019 21:45:10 +0100 Subject: [PATCH 6/8] Issue #644: Add the new unwrap mutator ucwords. (#645) * Issue #644: Add the new unwrap mutator ucwords. * Issue #644: Add the test case when ucwords has a delimiter parameter. --- src/Mutator/Unwrap/UnwrapUcWords.php | 54 ++++++ src/Mutator/Util/MutatorProfile.php | 2 + tests/Mutator/Unwrap/UnwrapUcWordsTest.php | 206 +++++++++++++++++++++ 3 files changed, 262 insertions(+) create mode 100644 src/Mutator/Unwrap/UnwrapUcWords.php create mode 100644 tests/Mutator/Unwrap/UnwrapUcWordsTest.php diff --git a/src/Mutator/Unwrap/UnwrapUcWords.php b/src/Mutator/Unwrap/UnwrapUcWords.php new file mode 100644 index 0000000000..894d0692bd --- /dev/null +++ b/src/Mutator/Unwrap/UnwrapUcWords.php @@ -0,0 +1,54 @@ + Mutator\Unwrap\UnwrapStrToUpper::class, 'UnwrapTrim' => Mutator\Unwrap\UnwrapTrim::class, 'UnwrapUcFirst' => Mutator\Unwrap\UnwrapUcFirst::class, + 'UnwrapUcWords' => Mutator\Unwrap\UnwrapUcWords::class, ]; } diff --git a/tests/Mutator/Unwrap/UnwrapUcWordsTest.php b/tests/Mutator/Unwrap/UnwrapUcWordsTest.php new file mode 100644 index 0000000000..58caa8dcd7 --- /dev/null +++ b/tests/Mutator/Unwrap/UnwrapUcWordsTest.php @@ -0,0 +1,206 @@ +doTest($input, $expected); + } + + public function provideMutationCases(): \Generator + { + yield 'It mutates correctly when provided with a string' => [ + <<<'PHP' + [ + <<<'PHP' + [ + <<<'PHP' + [ + <<<'PHP' + [ + <<<'PHP' + [ + <<<'PHP' +bar()); +PHP + , + <<<'PHP' +bar(); +PHP + ]; + + yield 'It mutates correctly when provided with a more complex situation' => [ + <<<'PHP' + [ + <<<'PHP' + [ + <<<'PHP' + [ + <<<'PHP' + [ + <<<'PHP' + Date: Fri, 22 Feb 2019 05:21:35 +0100 Subject: [PATCH 7/8] Test more versions on php 7.3 (#646) --- .travis.yml | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/.travis.yml b/.travis.yml index 00ddef0a32..79d594b89e 100644 --- a/.travis.yml +++ b/.travis.yml @@ -104,10 +104,29 @@ jobs: php: 7.2 env: DEPS="LOW" PHPDBG=1 + - + <<: *STANDARD_TEST_JOB + php: 7.3 + + - + <<: *STANDARD_TEST_JOB + php: 7.3 + env: NO_DEBUGGER=1 + - <<: *STANDARD_TEST_JOB php: 7.3 env: PHPDBG=1 + + - + <<: *STANDARD_TEST_JOB + php: 7.3 + env: DEPS="LOW" + + - + <<: *STANDARD_TEST_JOB + php: 7.3 + env: DEPS="LOW" PHPDBG=1 - <<: *STANDARD_TEST_JOB From b9568585ec45e3c88129f04c3c8122f26c3d333a Mon Sep 17 00:00:00 2001 From: Nikita Sobolev Date: Wed, 27 Feb 2019 20:35:36 +0300 Subject: [PATCH 8/8] Typo fixed (#648) --- tests/Fixtures/e2e/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/Fixtures/e2e/README.md b/tests/Fixtures/e2e/README.md index d2253a03ac..fed3d1ba5d 100644 --- a/tests/Fixtures/e2e/README.md +++ b/tests/Fixtures/e2e/README.md @@ -1,4 +1,4 @@ -#How-to +# How-to Every sub-folder should contain an e2e test case for `infection`. For each of these folders `standard_script.bash` is ran. This runs infection, and checks the difference between `expected-output.txt` and `infection.log`.