Skip to content

Commit

Permalink
Upgrade PHPUnit / test with PHP 7.4
Browse files Browse the repository at this point in the history
Needed to make tests pass on PHP 7.4
  • Loading branch information
JeroenDeDauw committed Mar 2, 2020
1 parent acf4784 commit 6a23979
Show file tree
Hide file tree
Showing 8 changed files with 21 additions and 17 deletions.
2 changes: 1 addition & 1 deletion .gitattributes
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@
composer.json export-ignore
phpcs.xml export-ignore
phpunit.xml.dist export-ignore
tests export-ignore
tests export-ignore
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,4 @@ vendor/

composer.phar
composer.lock
.phpunit.result.cache
4 changes: 1 addition & 3 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
language: php

php:
- 7.0
- 7.1
- 7.2
- 7.3
- 7.4
Expand All @@ -14,7 +12,7 @@ install: travis_retry composer install --prefer-source
script: composer ci

after_success:
- if [[ "`phpenv version-name`" != "7.0" ]]; then exit 0; fi
- if [[ "`phpenv version-name`" != "7.4" ]]; then exit 0; fi
- vendor/bin/phpunit --coverage-clover coverage.clover
- wget https://scrutinizer-ci.com/ocular.phar
- php ocular.phar code-coverage:upload --format=php-clover coverage.clover
Expand Down
5 changes: 5 additions & 0 deletions RELEASE-NOTES.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,11 @@ Latest release:
[![Latest Stable Version](https://poser.pugx.org/diff/diff/version.png)](https://packagist.org/packages/diff/diff)


## Version 3.3 (development)

* Raised minimum PHP version from 7.0 to 7.2
* Added testing with PHP 7.3 and 7.4

## Version 3.2 (2018-09-11)

* Deprecated constant `Diff_VERSION`
Expand Down
6 changes: 3 additions & 3 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,10 @@
"irc": "irc:https://irc.freenode.net/wikimedia-de-tech"
},
"require": {
"php": ">=7.0"
"php": ">=7.2"
},
"require-dev": {
"phpunit/phpunit": "~6.2",
"phpunit/phpunit": "~8.5.0",
"squizlabs/php_codesniffer": "~3.4.0",
"ockcyp/covers-validator": "~1.0"
},
Expand All @@ -46,7 +46,7 @@
},
"extra": {
"branch-alias": {
"dev-master": "3.2.x-dev"
"dev-master": "3.x-dev"
}
},
"scripts": {
Expand Down
2 changes: 1 addition & 1 deletion tests/unit/DiffOp/Diff/DiffAsOpTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ public function testToArrayMore( Diff $diffOp ) {
$array = $diffOp->toArray();

$this->assertArrayHasKey( 'operations', $array );
$this->assertInternalType( 'array', $array['operations'] );
$this->assertIsArray( $array['operations'] );

$this->assertArrayHasKey( 'isassoc', $array );

Expand Down
8 changes: 4 additions & 4 deletions tests/unit/DiffOp/Diff/DiffTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ public function testGetRemovals( array $operations ) {

public function testGetType() {
$diff = new Diff();
$this->assertInternalType( 'string', $diff->getType() );
$this->assertIsString( $diff->getType() );
}

public function testPreSetElement() {
Expand Down Expand Up @@ -158,7 +158,7 @@ public function instanceProvider() {
public function testGetOperations( Diff $diff ) {
$ops = $diff->getOperations();

$this->assertInternalType( 'array', $ops );
$this->assertIsArray( $ops );
$this->assertContainsOnlyInstancesOf( 'Diff\DiffOp\DiffOp', $ops );
$this->assertArrayEquals( $ops, $diff->getOperations() );
}
Expand Down Expand Up @@ -370,7 +370,7 @@ public function testGetAddedValues() {

$addedValues = $diff->getAddedValues();

$this->assertInternalType( 'array', $addedValues );
$this->assertIsArray( $addedValues );

$this->assertArrayEquals( array( 0, 2, 4 ), $addedValues );

Expand All @@ -391,7 +391,7 @@ public function testGetRemovedValues() {

$removedValues = $diff->getRemovedValues();

$this->assertInternalType( 'array', $removedValues );
$this->assertIsArray( $removedValues );

$this->assertArrayEquals( array( 1, 3 ), $removedValues );

Expand Down
10 changes: 5 additions & 5 deletions tests/unit/DiffOp/DiffOpTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -93,14 +93,14 @@ public function testConstructor() {
* @dataProvider instanceProvider
*/
public function testIsAtomic( DiffOp $diffOp ) {
$this->assertInternalType( 'boolean', $diffOp->isAtomic() );
$this->assertIsBool( $diffOp->isAtomic() );
}

/**
* @dataProvider instanceProvider
*/
public function testGetType( DiffOp $diffOp ) {
$this->assertInternalType( 'string', $diffOp->getType() );
$this->assertIsString( $diffOp->getType() );
}

/**
Expand Down Expand Up @@ -140,9 +140,9 @@ public function testCount( DiffOp $diffOp ) {
public function testToArray( DiffOp $diffOp ) {
$array = $diffOp->toArray();

$this->assertInternalType( 'array', $array );
$this->assertIsArray( $array );
$this->assertArrayHasKey( 'type', $array );
$this->assertInternalType( 'string', $array['type'] );
$this->assertIsString( $array['type'] );
$this->assertEquals( $diffOp->getType(), $array['type'] );
}

Expand All @@ -154,7 +154,7 @@ public function testToArrayWithConversion( DiffOp $diffOp ) {
return array( 'Nyan!' );
} );

$this->assertInternalType( 'array', $array );
$this->assertIsArray( $array );
}

}

0 comments on commit 6a23979

Please sign in to comment.