Skip to content
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
25 changes: 6 additions & 19 deletions .github/workflows/run-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,38 +12,25 @@ jobs:
fail-fast: false
matrix:
os: [ubuntu-latest]
php: [8.4, 8.3, 8.2, 8.1, 8.0]
laravel: ['9.*', '10.*', '11.*', '12.*']
php: [8.4, 8.3]
laravel: ['11.*', '12.*', '13.*']
dependency-version: [prefer-stable]
include:
- laravel: 10.*
testbench: 8.*
- laravel: 9.*
testbench: 7.*
- laravel: 11.*
testbench: 9.*
- laravel: 12.*
testbench: 10.*
exclude:
- laravel: 10.*
php: 8.0
- laravel: 11.*
php: 8.1
- laravel: 11.*
php: 8.0
- laravel: 12.*
php: 8.1
- laravel: 12.*
php: 8.0
- laravel: 13.*
testbench: 11.*

name: P${{ matrix.php }} - L${{ matrix.laravel }} - ${{ matrix.dependency-version }} - ${{ matrix.os }}

steps:
- name: Checkout code
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Cache dependencies
uses: actions/cache@v1
uses: actions/cache@v4
with:
path: ~/.composer/cache/files
key: dependencies-laravel-${{ matrix.laravel }}-php-${{ matrix.php }}-composer-${{ hashFiles('composer.json') }}
Expand Down
8 changes: 4 additions & 4 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,13 @@
}
],
"require": {
"php": "^7.2|^8.0",
"illuminate/support": "^6.0|^7.0|^8.67|^9.0|^10.0|^11.0|^12.0",
"php": "^8.3",
"illuminate/support": "^11.0|^12.0|^13.0",
"guzzlehttp/guzzle": "^6.5|^7.0"
},
"require-dev": {
"phpunit/phpunit": "^8.5.21|^9.0|^9.4.4|^10.5|^11.5.3",
"orchestra/testbench": "^4.0|^5.0|^6.0|^8.0|^9.0|^10.0"
"phpunit/phpunit": "^11.5.3|^12.5.12",
"orchestra/testbench": "^9.0|^10.0|^11.0"
},
"autoload": {
"psr-4": {
Expand Down
6 changes: 3 additions & 3 deletions phpunit.xml.dist
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
<?xml version="1.0" encoding="UTF-8"?>
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" bootstrap="vendor/autoload.php" backupGlobals="false" backupStaticAttributes="false" colors="true" verbose="true" convertErrorsToExceptions="true" convertNoticesToExceptions="true" convertWarningsToExceptions="true" processIsolation="false" stopOnFailure="false" xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/9.3/phpunit.xsd">
<coverage>
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" bootstrap="vendor/autoload.php" colors="true" xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/11.0/phpunit.xsd">
<source>
<include>
<directory suffix=".php">src/</directory>
</include>
</coverage>
</source>
<testsuites>
<testsuite name="Spatie Test Suite">
<directory>tests</directory>
Expand Down
38 changes: 19 additions & 19 deletions tests/GeocoderTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ public function setUp(): void
}

/** @test */
public function it_can_geocode_a_city()
public function test_it_can_geocode_a_city()
{
$result = $this->geocoder->getCoordinatesForAddress('Antwerp');

Expand All @@ -41,7 +41,7 @@ public function it_can_geocode_a_city()
}

/** @test */
public function it_can_geocode_a_city_with_multiple_responses()
public function test_it_can_geocode_a_city_with_multiple_responses()
{
$results = $this->geocoder->getAllCoordinatesForAddress('Washingtons');

Expand All @@ -58,23 +58,23 @@ public function it_can_geocode_a_city_with_multiple_responses()
}

/** @test */
public function it_should_return_an_empty_response_when_called_with_empty_query()
public function test_it_should_return_an_empty_response_when_called_with_empty_query()
{
$this->assertEquals($this->emptyResponse(), $this->geocoder->getCoordinatesForAddress(''));
}

/** @test */
public function it_should_return_an_empty_response_when_using_a_non_existing_city()
public function test_it_should_return_an_empty_response_when_using_a_non_existing_city()
{
$this->assertEquals($this->emptyResponse(), $this->geocoder->getCoordinatesForAddress('Spatieville'));
}

/** @test */
public function it_can_translate_the_data()
public function test_it_can_translate_the_data()
{
$result = $this->geocoder->getCoordinatesForAddress('Roma, Italy');

$this->assertEquals('Rome, Metropolitan City of Rome, Italy', $result['formatted_address']);
$this->assertEquals('Rome, Metropolitan City of Rome Capital, Italy', $result['formatted_address']);

$result = $this->geocoder
->setLanguage('it')
Expand All @@ -84,21 +84,21 @@ public function it_can_translate_the_data()
}

/** @test */
public function it_can_translate_coordinates_to_an_address()
public function test_it_can_translate_coordinates_to_an_address()
{
$result = $this->geocoder->getAddressForCoordinates(40.714224, -73.961452);

$this->assertEquals('277 Bedford Ave, Brooklyn, NY 11211, USA', $result['formatted_address']);
$this->assertEquals('279 Bedford Ave, Brooklyn, NY 11211, USA', $result['formatted_address']);

$result = $this->geocoder
->setLanguage('nl')
->getAddressForCoordinates(40.714224, -73.961452);

$this->assertEquals('277 Bedford Ave, Brooklyn, NY 11211, Verenigde Staten', $result['formatted_address']);
$this->assertEquals('279 Bedford Ave, Brooklyn, NY 11211, Verenigde Staten', $result['formatted_address']);
}

/** @test */
public function it_can_translate_coordinates_to_multiple_addresses()
public function test_it_can_translate_coordinates_to_multiple_addresses()
{
$results = $this->geocoder->getAllAddressesForCoordinates(40.714224, -73.961452);

Expand All @@ -107,43 +107,43 @@ public function it_can_translate_coordinates_to_multiple_addresses()

$result = $results[0];

$this->assertEquals('277 Bedford Ave, Brooklyn, NY 11211, USA', $result['formatted_address']);
$this->assertEquals('279 Bedford Ave, Brooklyn, NY 11211, USA', $result['formatted_address']);

$result = $this->geocoder
->setLanguage('nl')
->getAddressForCoordinates(40.714224, -73.961452);

$this->assertEquals('277 Bedford Ave, Brooklyn, NY 11211, Verenigde Staten', $result['formatted_address']);
$this->assertEquals('279 Bedford Ave, Brooklyn, NY 11211, Verenigde Staten', $result['formatted_address']);
}

/** @test */
public function it_can_include_the_address_components_in_a_response()
public function test_it_can_include_the_address_components_in_a_response()
{
$results = $this->geocoder->getCoordinatesForAddress('Infinite Loop 1, Cupertino');

$this->assertArrayHasKey('address_components', $results);
}

/** @test */
public function it_includes_the_place_id_in_a_response()
public function test_it_includes_the_place_id_in_a_response()
{
$results = $this->geocoder->getCoordinatesForAddress('Infinite Loop 1, Cupertino');

$this->assertArrayHasKey('place_id', $results);
}

/** @test */
public function it_should_prefer_a_neighborhood_inside_of_payload_bounds()
public function test_it_should_prefer_a_neighborhood_inside_of_payload_bounds()
{
$results = $this->geocoder
->setBounds('34.172684,-118.604794|34.236144,-118.500938')
->getCoordinatesForAddress('Winnetka');

$this->assertEquals('Winnetka, IL, USA', $results['formatted_address']);
$this->assertEquals('Winnetka, Los Angeles, CA, USA', $results['formatted_address']);
}

/** @test */
public function it_can_be_used_with_a_laravel_facade()
public function test_it_can_be_used_with_a_laravel_facade()
{
config()->set('geocoder.key', $this->getApiKey());

Expand All @@ -153,7 +153,7 @@ public function it_can_be_used_with_a_laravel_facade()
}

/** @test */
public function it_can_be_resolved_from_the_container_with_the_alias()
public function test_it_can_be_resolved_from_the_container_with_the_alias()
{
config()->set('geocoder.key', $this->getApiKey());

Expand All @@ -163,7 +163,7 @@ public function it_can_be_resolved_from_the_container_with_the_alias()
}

/** @test */
public function it_can_be_resolved_from_the_container_with_the_full_class_name()
public function test_it_can_be_resolved_from_the_container_with_the_full_class_name()
{
config()->set('geocoder.key', $this->getApiKey());

Expand Down