Skip to content

Commit d2539d3

Browse files
committed
Merge branch '2.12' into 2.14
* 2.12: PhpUnitConstructFixer - Fix handle different casing Collect coverage with PCOV
2 parents a06dacb + 4811794 commit d2539d3

File tree

4 files changed

+33
-6
lines changed

4 files changed

+33
-6
lines changed

.travis.yml

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -118,8 +118,24 @@ jobs:
118118

119119
# Composer: boost installation
120120
- composer global show hirak/prestissimo -q || travis_retry composer global require $DEFAULT_COMPOSER_FLAGS hirak/prestissimo
121+
122+
# Require PHPUnit 8
123+
- composer require --dev --no-update phpunit/phpunit:^8
124+
125+
# Install PCOV
126+
- |
127+
git clone --single-branch --branch=v1.0.2 --depth=1 https://github.com/krakjoe/pcov
128+
cd pcov
129+
phpize
130+
./configure
131+
make clean install
132+
echo "extension=pcov.so" > $HOME/.phpenv/versions/$TRAVIS_PHP_VERSION/etc/conf.d/pcov.ini
133+
cd $TRAVIS_BUILD_DIR
134+
before_script:
135+
# Make code compatible with PHPUnit 8
136+
- PHP_CS_FIXER_FUTURE_MODE=1 php php-cs-fixer fix --rules=void_return -q tests || return 0
121137
script:
122-
- phpdbg -qrr vendor/bin/phpunit --testsuite coverage --exclude-group covers-nothing --coverage-clover build/logs/clover.xml || travis_terminate 1
138+
- vendor/bin/phpunit --testsuite coverage --exclude-group covers-nothing --coverage-clover build/logs/clover.xml || travis_terminate 1
123139
- php vendor/bin/php-coveralls -v
124140

125141
-
@@ -152,4 +168,3 @@ jobs:
152168

153169
allow_failures:
154170
- php: 7.4snapshot
155-
- env: COLLECT_COVERAGE=1

composer.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38,10 +38,10 @@
3838
"mikey179/vfsstream": "^1.6",
3939
"php-coveralls/php-coveralls": "^2.1",
4040
"php-cs-fixer/accessible-object": "^1.0",
41-
"php-cs-fixer/phpunit-constraint-isidenticalstring": "^1.0.1",
42-
"php-cs-fixer/phpunit-constraint-xmlmatchesxsd": "^1.0.1",
41+
"php-cs-fixer/phpunit-constraint-isidenticalstring": "^1.1",
42+
"php-cs-fixer/phpunit-constraint-xmlmatchesxsd": "^1.1",
4343
"phpunit/phpunit": "^5.7.27 || ^6.5.8 || ^7.1",
44-
"phpunitgoodpractices/traits": "^1.5.1",
44+
"phpunitgoodpractices/traits": "^1.8",
4545
"symfony/phpunit-bridge": "^4.0"
4646
},
4747
"suggest": {

src/Fixer/PhpUnit/PhpUnitConstructFixer.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -215,7 +215,7 @@ private function fixAssert(array $map, Tokens $tokens, $index, $method)
215215
return $sequenceIndexes[3];
216216
}
217217

218-
$tokens[$sequenceIndexes[0]] = new Token([T_STRING, $map[$firstParameterToken->getContent()]]);
218+
$tokens[$sequenceIndexes[0]] = new Token([T_STRING, $map[strtolower($firstParameterToken->getContent())]]);
219219
$tokens->clearRange($sequenceIndexes[2], $tokens->getNextNonWhitespace($sequenceIndexes[3]) - 1);
220220

221221
return $sequenceIndexes[3];

tests/Fixer/PhpUnit/PhpUnitConstructFixerTest.php

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -125,6 +125,18 @@ public function provideTestFixCases()
125125
'<?php $this->assertSame(true || $a, $b); $this->assertTrue($c);',
126126
'<?php $this->assertSame(true || $a, $b); $this->assertSame(true, $c);',
127127
],
128+
[
129+
'<?php $this->assertFalse($foo);',
130+
'<?php $this->assertEquals(FALSE, $foo);',
131+
],
132+
[
133+
'<?php $this->assertTrue($foo);',
134+
'<?php $this->assertEquals(TruE, $foo);',
135+
],
136+
[
137+
'<?php $this->assertNull($foo);',
138+
'<?php $this->assertEquals(NULL, $foo);',
139+
],
128140
];
129141

130142
return array_merge(

0 commit comments

Comments
 (0)