Skip to content

Commit

Permalink
Enable PHPStan Level 6 (#1194)
Browse files Browse the repository at this point in the history
* Update phpstan.neon

* Update YandexTest.php

* Update TomTomTest.php

* Update PickPointTest.php

* Update PickPoint.php

* Update PhotonTest.php

* Update PeliasTest.php

* Update OpenRouteServiceTest.php

* Update OpenCageTest.php

* Update OpenCage.php

* Update NominatimTest.php

* Update MaxMindBinaryTest.php

* Update MaxMindTest.php

* [WIP] Apply PHPStan fixes

* Apply PHPCSFixer fixes

* [WIP] Apply PHPStan fixes

* [WIP] Apply PHPStan fixes

* Revert "[WIP] Apply PHPStan fixes"

This reverts commit 734c5c52fbcba4bc12cbda07b58d902a79d47891.

* [WIP] Apply PHPStan fixes

* [WIP] Apply PHPStan fixes

* Update phpstan-baseline.neon
  • Loading branch information
jbelien committed Jul 31, 2023
1 parent 2a3737e commit e0b8d8e
Showing 1 changed file with 14 additions and 14 deletions.
28 changes: 14 additions & 14 deletions Tests/TomTomTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,26 +21,26 @@

class TomTomTest extends BaseTestCase
{
protected function getCacheDir()
protected function getCacheDir(): string
{
return __DIR__.'/.cached_responses';
}

public function testGetName()
public function testGetName(): void
{
$provider = new TomTom($this->getMockedHttpClient(), 'api_key');
$this->assertEquals('tomtom', $provider->getName());
}

public function testGeocodeWithAddress()
public function testGeocodeWithAddress(): void
{
$this->expectException(\Geocoder\Exception\InvalidServerResponse::class);

$provider = new TomTom($this->getMockedHttpClient(), 'api_key');
$provider->geocodeQuery(GeocodeQuery::create('Tagensvej 47, 2200 København N'));
}

public function testGeocodeWithRealAddress()
public function testGeocodeWithRealAddress(): void
{
$provider = new TomTom($this->getHttpClient($_SERVER['TOMTOM_MAP_KEY']), $_SERVER['TOMTOM_MAP_KEY']);
$results = $provider->geocodeQuery(GeocodeQuery::create('Tagensvej 47, 2200 København N')->withLocale('en-GB'));
Expand All @@ -64,7 +64,7 @@ public function testGeocodeWithRealAddress()
$this->assertNull($result->getTimezone());
}

public function testGeocodeWithRealAddressWithFrenchLocale()
public function testGeocodeWithRealAddressWithFrenchLocale(): void
{
$provider = new TomTom($this->getHttpClient($_SERVER['TOMTOM_MAP_KEY']), $_SERVER['TOMTOM_MAP_KEY']);
$results = $provider->geocodeQuery(GeocodeQuery::create('Tagensvej 47, 2200 København N')->withLocale('fr-FR'));
Expand All @@ -77,7 +77,7 @@ public function testGeocodeWithRealAddressWithFrenchLocale()
$this->assertInstanceOf('\Geocoder\Model\Address', $result);
}

public function testGeocodeWithLocalhostIPv4()
public function testGeocodeWithLocalhostIPv4(): void
{
$this->expectException(\Geocoder\Exception\UnsupportedOperation::class);
$this->expectExceptionMessage('The TomTom provider does not support IP addresses, only street addresses.');
Expand All @@ -86,7 +86,7 @@ public function testGeocodeWithLocalhostIPv4()
$provider->geocodeQuery(GeocodeQuery::create('127.0.0.1'));
}

public function testGeocodeWithLocalhostIPv6()
public function testGeocodeWithLocalhostIPv6(): void
{
$this->expectException(\Geocoder\Exception\UnsupportedOperation::class);
$this->expectExceptionMessage('The TomTom provider does not support IP addresses, only street addresses.');
Expand All @@ -95,7 +95,7 @@ public function testGeocodeWithLocalhostIPv6()
$provider->geocodeQuery(GeocodeQuery::create('::1'));
}

public function testGeocodeWithIPv4()
public function testGeocodeWithIPv4(): void
{
$this->expectException(\Geocoder\Exception\UnsupportedOperation::class);
$this->expectExceptionMessage('The TomTom provider does not support IP addresses, only street addresses.');
Expand All @@ -104,7 +104,7 @@ public function testGeocodeWithIPv4()
$provider->geocodeQuery(GeocodeQuery::create('74.200.247.59'));
}

public function testGeocodeWithIPv6()
public function testGeocodeWithIPv6(): void
{
$this->expectException(\Geocoder\Exception\UnsupportedOperation::class);
$this->expectExceptionMessage('The TomTom provider does not support IP addresses, only street addresses.');
Expand All @@ -113,23 +113,23 @@ public function testGeocodeWithIPv6()
$provider->geocodeQuery(GeocodeQuery::create('::ffff:74.200.247.59'));
}

public function testWithoutApiKey()
public function testWithoutApiKey(): void
{
$this->expectException(\Geocoder\Exception\InvalidCredentials::class);
$this->expectExceptionMessage('No API key provided');

new TomTom($this->getMockedHttpClient(), '');
}

public function testReverse()
public function testReverse(): void
{
$this->expectException(\Geocoder\Exception\InvalidServerResponse::class);

$provider = new TomTom($this->getMockedHttpClient(), 'api_key');
$provider->reverseQuery(ReverseQuery::fromCoordinates(1, 2));
}

public function testReverseError400()
public function testReverseError400(): void
{
$error400 = <<<'JSON'
{
Expand All @@ -150,7 +150,7 @@ public function testReverseError400()
$this->assertEquals(0, $result->count());
}

public function testReverseWithRealCoordinates()
public function testReverseWithRealCoordinates(): void
{
if (!isset($_SERVER['TOMTOM_MAP_KEY'])) {
$this->markTestSkipped('You need to configure the TOMTOM_MAP_KEY value in phpunit.xml');
Expand Down Expand Up @@ -178,7 +178,7 @@ public function testReverseWithRealCoordinates()
$this->assertNull($result->getTimezone());
}

public function testGeocodeWithRealCoordinates()
public function testGeocodeWithRealCoordinates(): void
{
if (!isset($_SERVER['TOMTOM_MAP_KEY'])) {
$this->markTestSkipped('You need to configure the TOMTOM_MAP_KEY value in phpunit.xml');
Expand Down

0 comments on commit e0b8d8e

Please sign in to comment.