Skip to content
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

Allow PHP8 & Fix PHPUnit deprecations #146

Merged
merged 2 commits into from
Feb 2, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,16 @@ matrix:
# Minimum supported dependencies with the latest and oldest PHP version
- php: 7.3
env: COMPOSER_FLAGS="--prefer-stable --prefer-lowest" SYMFONY_DEPRECATIONS_HELPER="weak_vendors"
- php: 7.4
- php: 8.0
env: COMPOSER_FLAGS="--prefer-stable --prefer-lowest" SYMFONY_DEPRECATIONS_HELPER="weak_vendors"

# Test the latest stable release
- php: 7.3
env: COVERAGE=true PHPUNIT_FLAGS="-v --coverage-text"
- php: 7.4
env: COVERAGE=true PHPUNIT_FLAGS="-v --coverage-text"
- php: 8.0
env: COVERAGE=true PHPUNIT_FLAGS="-v --coverage-text"

- php: 7.3
env: SYMFONY_REQUIRE="~3.4"
Expand All @@ -38,11 +40,16 @@ matrix:
- php: 7.4
env: SYMFONY_REQUIRE="~5.0"

- php: 8.0
env: SYMFONY_REQUIRE="~5.0"

# Latest commit to master
- php: 7.3
env: STABILITY="dev"
- php: 7.4
env: STABILITY="dev"
- php: 8.0
env: STABILITY="dev"

allow_failures:
# Dev-master is allowed to fail.
Expand Down
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
},

"require" : {
"php" : "^7.3 || ^7.4",
"php" : "^7.3 || ^7.4 || ^8.0",
"psr/cache" : "^1.0",
"willdurand/geocoder" : "^4.2",
"react/promise" : "^2.2",
Expand Down
23 changes: 11 additions & 12 deletions tests/Batch/BatchTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,9 @@ protected function setup(): void
$this->geocoder = $this->getMockGeocoderReturns($this->providers);
}

/**
* @doesNotPerformAssertions
*/
public function testConstructorShouldAcceptGeocoderInterface()
{
new TestableBatch($this->getStubGeocoder());
Expand Down Expand Up @@ -113,12 +116,12 @@ public function testGeocodeShouldMadeCorrectTasksArrayToComputeWithManyValues()
}

/**
* @expectedException League\Geotools\Exception\InvalidArgumentException
* @expectedExceptionMessage The argument should be a string or an array of strings to geocode.
* @dataProvider invalidValuesProvider
*/
public function testGeocodeShouldThrowInvalidArgumentException($values)
{
$this->expectException(\League\Geotools\Exception\InvalidArgumentException::class);
$this->expectExceptionMessage('The argument should be a string or an array of strings to geocode.');
$batch = new TestableBatch($this->geocoder);
$batch->geocode($values);
}
Expand Down Expand Up @@ -168,12 +171,12 @@ public function testReverseShouldMadeCorrectTasksArrayToComputeWithManyCoordinat
}

/**
* @expectedException League\Geotools\Exception\InvalidArgumentException
* @expectedExceptionMessage The argument should be a Coordinate instance or an array of Coordinate instances to reverse.
* @dataProvider coordinatesProvider
*/
public function testReverseShouldThrowInvalidArgumentException($coordinates)
{
$this->expectException(\League\Geotools\Exception\InvalidArgumentException::class);
$this->expectExceptionMessage('The argument should be a Coordinate instance or an array of Coordinate instances to reverse.');
$batch = new TestableBatch($this->geocoder);
$batch->reverse($coordinates);
}
Expand Down Expand Up @@ -735,12 +738,10 @@ public function testBatchReverseGeocodingInParallelReturnNewGeocodedInstanceWith
}
}

/**
* @expectedException RuntimeException
* @expectedExceptionMessage booooooooooo!
*/
public function testSeriesShouldThrowException()
{
$this->expectException(\RuntimeException::class);
$this->expectExceptionMessage('booooooooooo!');
$batch = new TestableBatch($this->geocoder);
$batch->setTasks($tasks = array(
function () {
Expand All @@ -755,12 +756,10 @@ function () {
))->geocode('foo')->serie();
}

/**
* @expectedException RuntimeException
* @expectedExceptionMessage booooooooooo!
*/
public function testParallelShouldThrowException()
{
$this->expectException(\RuntimeException::class);
$this->expectExceptionMessage('booooooooooo!');
$called = 0;

$batch = new TestableBatch($this->geocoder);
Expand Down
13 changes: 10 additions & 3 deletions tests/BoundingBox/BoundingBoxTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -50,27 +50,34 @@ public function polygonAndExpectedNorthWestAndSouthEastCoordinates()
);
}

/**
* @doesNotPerformAssertions
*/
public function testConstructWithPolygon()
{
new BoundingBox(new Polygon);
}


/**
* @doesNotPerformAssertions
*/
public function testConstructWithCoordinate()
{
new BoundingBox(new Coordinate(array(0, 0)));
}

/**
* @doesNotPerformAssertions
*/
public function testConstructWithNull()
{
new BoundingBox;
}

/**
* @expectedException \InvalidArgumentException
*/
public function testConstructWithInvalidArgument()
{
$this->expectException(\InvalidArgumentException::class);
new BoundingBox('string');
}

Expand Down
24 changes: 8 additions & 16 deletions tests/CLI/Command/Convert/DMSTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,23 +34,19 @@ protected function setup(): void
$this->commandTester = new CommandTester($this->command);
}

/**
* @expectedException \RuntimeException
* @expectedExceptionMessage Not enough arguments
*/
public function testExecuteWithoutArguments()
{
$this->expectException(\RuntimeException::class);
$this->expectExceptionMessage('Not enough arguments');
$this->commandTester->execute(array(
'command' => $this->command->getName(),
));
}

/**
* @expectedException League\Geotools\Exception\InvalidArgumentException
* @expectedExceptionMessage It should be a valid and acceptable ways to write geographic coordinates !
*/
public function testExecuteInvalidArguments()
{
$this->expectException(\League\Geotools\Exception\InvalidArgumentException::class);
$this->expectExceptionMessage('It should be a valid and acceptable ways to write geographic coordinates !');
$this->commandTester->execute(array(
'command' => $this->command->getName(),
'coordinate' => 'foo, bar',
Expand Down Expand Up @@ -93,25 +89,21 @@ public function testExecuteWithEmptyFormatOption()
$this->assertRegExp('/<value> <\/value>/', $this->commandTester->getDisplay());
}

/**
* @expectedException League\Geotools\Exception\InvalidArgumentException
* @expectedExceptionMessage Please provide an ellipsoid name !
*/
public function testExecuteWithEmptyEllipsoidOption()
{
$this->expectException(\League\Geotools\Exception\InvalidArgumentException::class);
$this->expectExceptionMessage('Please provide an ellipsoid name !');
$this->commandTester->execute(array(
'command' => $this->command->getName(),
'coordinate' => '40° 26.7717, -79° 56.93172',
'--ellipsoid' => ' ',
));
}

/**
* @expectedException League\Geotools\Exception\InvalidArgumentException
* @expectedExceptionMessage foo ellipsoid does not exist in selected reference ellipsoids !
*/
public function testExecuteWithoutAvailableEllipsoidOption()
{
$this->expectException(\League\Geotools\Exception\InvalidArgumentException::class);
$this->expectExceptionMessage('foo ellipsoid does not exist in selected reference ellipsoids !');
$this->commandTester->execute(array(
'command' => $this->command->getName(),
'coordinate' => '40° 26.7717, -79° 56.93172',
Expand Down
24 changes: 8 additions & 16 deletions tests/CLI/Command/Convert/DMTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,23 +34,19 @@ protected function setup(): void
$this->commandTester = new CommandTester($this->command);
}

/**
* @expectedException \RuntimeException
* @expectedExceptionMessage Not enough arguments
*/
public function testExecuteWithoutArguments()
{
$this->expectException(\RuntimeException::class);
$this->expectExceptionMessage('Not enough arguments');
$this->commandTester->execute(array(
'command' => $this->command->getName(),
));
}

/**
* @expectedException League\Geotools\Exception\InvalidArgumentException
* @expectedExceptionMessage It should be a valid and acceptable ways to write geographic coordinates !
*/
public function testExecuteInvalidArguments()
{
$this->expectException(\League\Geotools\Exception\InvalidArgumentException::class);
$this->expectExceptionMessage('It should be a valid and acceptable ways to write geographic coordinates !');
$this->commandTester->execute(array(
'command' => $this->command->getName(),
'coordinate' => 'foo, bar',
Expand Down Expand Up @@ -93,25 +89,21 @@ public function testExecuteWithEmptyFormatOption()
$this->assertRegExp('/<value> <\/value>/', $this->commandTester->getDisplay());
}

/**
* @expectedException League\Geotools\Exception\InvalidArgumentException
* @expectedExceptionMessage Please provide an ellipsoid name !
*/
public function testExecuteWithEmptyEllipsoidOption()
{
$this->expectException(\League\Geotools\Exception\InvalidArgumentException::class);
$this->expectExceptionMessage('Please provide an ellipsoid name !');
$this->commandTester->execute(array(
'command' => $this->command->getName(),
'coordinate' => '40° 26.7717, -79° 56.93172',
'--ellipsoid' => ' ',
));
}

/**
* @expectedException League\Geotools\Exception\InvalidArgumentException
* @expectedExceptionMessage foo ellipsoid does not exist in selected reference ellipsoids !
*/
public function testExecuteWithoutAvailableEllipsoidOption()
{
$this->expectException(\League\Geotools\Exception\InvalidArgumentException::class);
$this->expectExceptionMessage('foo ellipsoid does not exist in selected reference ellipsoids !');
$this->commandTester->execute(array(
'command' => $this->command->getName(),
'coordinate' => '40° 26.7717, -79° 56.93172',
Expand Down
24 changes: 8 additions & 16 deletions tests/CLI/Command/Convert/UTMTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,23 +34,19 @@ protected function setup(): void
$this->commandTester = new CommandTester($this->command);
}

/**
* @expectedException \RuntimeException
* @expectedExceptionMessage Not enough arguments
*/
public function testExecuteWithoutArguments()
{
$this->expectException(\RuntimeException::class);
$this->expectExceptionMessage('Not enough arguments');
$this->commandTester->execute(array(
'command' => $this->command->getName(),
));
}

/**
* @expectedException League\Geotools\Exception\InvalidArgumentException
* @expectedExceptionMessage It should be a valid and acceptable ways to write geographic coordinates !
*/
public function testExecuteInvalidArguments()
{
$this->expectException(\League\Geotools\Exception\InvalidArgumentException::class);
$this->expectExceptionMessage('It should be a valid and acceptable ways to write geographic coordinates !');
$this->commandTester->execute(array(
'command' => $this->command->getName(),
'coordinate' => 'foo, bar',
Expand All @@ -68,25 +64,21 @@ public function testExecute()
$this->assertRegExp('/31U 449152 5408055/', $this->commandTester->getDisplay());
}

/**
* @expectedException League\Geotools\Exception\InvalidArgumentException
* @expectedExceptionMessage Please provide an ellipsoid name !
*/
public function testExecuteWithEmptyEllipsoidOption()
{
$this->expectException(\League\Geotools\Exception\InvalidArgumentException::class);
$this->expectExceptionMessage('Please provide an ellipsoid name !');
$this->commandTester->execute(array(
'command' => $this->command->getName(),
'coordinate' => '40° 26.7717, -79° 56.93172',
'--ellipsoid' => ' ',
));
}

/**
* @expectedException League\Geotools\Exception\InvalidArgumentException
* @expectedExceptionMessage foo ellipsoid does not exist in selected reference ellipsoids !
*/
public function testExecuteWithoutAvailableEllipsoidOption()
{
$this->expectException(\League\Geotools\Exception\InvalidArgumentException::class);
$this->expectExceptionMessage('foo ellipsoid does not exist in selected reference ellipsoids !');
$this->commandTester->execute(array(
'command' => $this->command->getName(),
'coordinate' => '40° 26.7717, -79° 56.93172',
Expand Down
24 changes: 8 additions & 16 deletions tests/CLI/Command/Distance/AllTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,23 +34,19 @@ protected function setup(): void
$this->commandTester = new CommandTester($this->command);
}

/**
* @expectedException \RuntimeException
* @expectedExceptionMessage Not enough arguments
*/
public function testExecuteWithoutArguments()
{
$this->expectException(\RuntimeException::class);
$this->expectExceptionMessage('Not enough arguments');
$this->commandTester->execute(array(
'command' => $this->command->getName(),
));
}

/**
* @expectedException League\Geotools\Exception\InvalidArgumentException
* @expectedExceptionMessage It should be a valid and acceptable ways to write geographic coordinates !
*/
public function testExecuteInvalidArguments()
{
$this->expectException(\League\Geotools\Exception\InvalidArgumentException::class);
$this->expectExceptionMessage('It should be a valid and acceptable ways to write geographic coordinates !');
$this->commandTester->execute(array(
'command' => $this->command->getName(),
'origin' => 'foo, bar',
Expand Down Expand Up @@ -136,12 +132,10 @@ public function testExecuteOutput()
$this->assertSame($expected, $this->commandTester->getDisplay());
}

/**
* @expectedException League\Geotools\Exception\InvalidArgumentException
* @expectedExceptionMessage Please provide an ellipsoid name !
*/
public function testExecuteWithEmptyEllipsoidOption()
{
$this->expectException(\League\Geotools\Exception\InvalidArgumentException::class);
$this->expectExceptionMessage('Please provide an ellipsoid name !');
$this->commandTester->execute(array(
'command' => $this->command->getName(),
'origin' => '40° 26.7717, -79° 56.93172',
Expand All @@ -150,12 +144,10 @@ public function testExecuteWithEmptyEllipsoidOption()
));
}

/**
* @expectedException League\Geotools\Exception\InvalidArgumentException
* @expectedExceptionMessage foo ellipsoid does not exist in selected reference ellipsoids !
*/
public function testExecuteWithoutAvailableEllipsoidOption()
{
$this->expectException(\League\Geotools\Exception\InvalidArgumentException::class);
$this->expectExceptionMessage('foo ellipsoid does not exist in selected reference ellipsoids !');
$this->commandTester->execute(array(
'command' => $this->command->getName(),
'origin' => '40° 26.7717, -79° 56.93172',
Expand Down
Loading