Skip to content

Commit

Permalink
Merge pull request #6 from ARCANEDEV/develop
Browse files Browse the repository at this point in the history
Adding Laravel 5.5 support
  • Loading branch information
arcanedev-maroc authored Feb 19, 2018
2 parents 5273143 + fae9e5b commit 5ad0f5d
Show file tree
Hide file tree
Showing 22 changed files with 234 additions and 239 deletions.
11 changes: 4 additions & 7 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,30 +3,27 @@ language: php
sudo: false

php:
- 5.6
- 7.0
- 7.1
- 7.2
- nightly

matrix:
allow_failures:
- php: nightly

env:
- TESTBENCH_VERSION=3.4.*

services:
- redis-server

before_script:
- travis_retry composer self-update
- travis_retry composer require --prefer-source --no-interaction --dev "orchestra/testbench:${TESTBENCH_VERSION}"
- travis_retry composer install --prefer-source --no-interaction

script:
- composer validate
- mkdir -p build/logs
- vendor/bin/phpunit --coverage-text --coverage-clover=coverage.clover

after_script:
- if [ "$TRAVIS_PHP_VERSION" != "nightly" ]; then wget https://scrutinizer-ci.com/ocular.phar; fi
- if [ "$TRAVIS_PHP_VERSION" != "nightly" ]; then php ocular.phar code-coverage:upload --format=php-clover coverage.clover; fi
- if [ "$TRAVIS_PHP_VERSION" != "nightly" ]; then wget https://scrutinizer-ci.com/ocular.phar; fi
- if [ "$TRAVIS_PHP_VERSION" != "nightly" ]; then php ocular.phar code-coverage:upload --format=php-clover coverage.clover; fi
2 changes: 1 addition & 1 deletion LICENSE.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
The MIT License (MIT)

Copyright (c) 2017 | ARCANEDEV <[email protected]> - GeoLocation
Copyright (c) 2017-2018 | ARCANEDEV <[email protected]> - GeoLocation

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
25 changes: 8 additions & 17 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,14 @@
"type": "library",
"license": "MIT",
"require": {
"php": ">=5.6",
"arcanedev/support": "~4.0"
"php": ">=7.0",
"arcanedev/support": "~4.2.0"
},
"require-dev": {
"phpunit/phpcov": "~3.0",
"phpunit/phpunit": "~5.0",
"guzzlehttp/guzzle": "~6.0"
"orchestra/testbench": "~3.5.0",
"phpunit/phpcov": "~4.0",
"phpunit/phpunit": "~6.0",
"guzzlehttp/guzzle": "~6.0"
},
"autoload": {
"psr-4": {
Expand All @@ -34,17 +35,7 @@
"Arcanedev\\GeoLocation\\Tests\\": "tests/"
}
},
"scripts": {
"testbench": "composer require --dev \"orchestra/testbench=~3.0\""
},
"extra": {
"branch-alias": {
"dev-master": "1.0-dev"
}
},
"suggest": {
"guzzlehttp/guzzle": "(~6.0) Required to use the Google webservices."
},
"minimum-stability": "dev",
"prefer-stable" : true
"guzzlehttp/guzzle": "(~6.0) Required if you're going to use the Google webservices."
}
}
4 changes: 4 additions & 0 deletions src/GeoLocationServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@ class GeoLocationServiceProvider extends PackageServiceProvider
public function register()
{
parent::register();

//
}

/**
Expand All @@ -41,6 +43,8 @@ public function register()
public function boot()
{
parent::boot();

//
}

/**
Expand Down
28 changes: 14 additions & 14 deletions tests/Calculators/DistanceCalculatorTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ public function it_can_be_instantiated()
];

foreach ($expectations as $expected) {
$this->assertInstanceOf($expected, $calculator);
static::assertInstanceOf($expected, $calculator);
}
}

Expand All @@ -43,7 +43,7 @@ public function it_can_create_calculator()
];

foreach ($expectations as $expected) {
$this->assertInstanceOf($expected, $calculator);
static::assertInstanceOf($expected, $calculator);
}
}

Expand All @@ -56,19 +56,19 @@ public function it_can_calculate()

$expected = 0.0;

$this->assertSame($expected, $calc->calculate($start, $start)->getValue());
$this->assertSame($expected, $calc->calculate($start, $start)->value());
static::assertSame($expected, $calc->calculate($start, $start)->getValue());
static::assertSame($expected, $calc->calculate($start, $start)->value());

$this->assertSame($expected, $calc->calculate($end, $end)->getValue());
$this->assertSame($expected, $calc->calculate($end, $end)->value());
static::assertSame($expected, $calc->calculate($end, $end)->getValue());
static::assertSame($expected, $calc->calculate($end, $end)->value());

$expected = 1658771.9796656023;

$this->assertSame($expected, $calc->calculate($start, $end)->getValue());
$this->assertSame($expected, $calc->calculate($start, $end)->value());
static::assertSame($expected, $calc->calculate($start, $end)->getValue());
static::assertSame($expected, $calc->calculate($start, $end)->value());

$this->assertSame($expected, $calc->calculate($end, $start)->getValue());
$this->assertSame($expected, $calc->calculate($end, $start)->value());
static::assertSame($expected, $calc->calculate($end, $start)->getValue());
static::assertSame($expected, $calc->calculate($end, $start)->value());
}

/** @test */
Expand All @@ -78,10 +78,10 @@ public function it_can_calculate_rounded_distance()
$start = Position::create(31.7917,7.0926); // Morocco
$end = Position::create(46.2276, 2.2137); // France

$this->assertSame(1658771.98, $calc->distance($start, $end));
$this->assertSame(1658771.98, $calc->distance($end, $start));
static::assertSame(1658771.98, $calc->distance($start, $end));
static::assertSame(1658771.98, $calc->distance($end, $start));

$this->assertSame(1658772.0, $calc->distance($start, $end, 0));
$this->assertSame(1658772.0, $calc->distance($end, $start, 0));
static::assertSame(1658772.0, $calc->distance($start, $end, 0));
static::assertSame(1658772.0, $calc->distance($end, $start, 0));
}
}
16 changes: 8 additions & 8 deletions tests/Entities/Coordinates/LatitudeTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ public function it_can_be_instantiated()
{
$lat = $this->createLatitude();

$this->assertCoordinateInstance($lat);
$this->assertInstanceOf(\Arcanedev\GeoLocation\Entities\Coordinates\Latitude::class, $lat);
static::assertCoordinateInstance($lat);
static::assertInstanceOf(\Arcanedev\GeoLocation\Entities\Coordinates\Latitude::class, $lat);
}

/** @test */
Expand All @@ -31,20 +31,20 @@ public function it_can_get_and_set_value()
$lat = $this->createLatitude();
$value = 31.7917;

$this->assertSame($value, $lat->getValue());
$this->assertSame($value, $lat->value());
static::assertSame($value, $lat->getValue());
static::assertSame($value, $lat->value());

$lat->setValue(0);

$this->assertSame(0.0, $lat->getValue());
$this->assertSame(0.0, $lat->value());
static::assertSame(0.0, $lat->getValue());
static::assertSame(0.0, $lat->value());
}

/** @test */
public function it_can_get_min_and_max_values()
{
$this->assertSame(-90.0, Latitude::getMin());
$this->assertSame(90.0, Latitude::getMax());
static::assertSame(-90.0, Latitude::getMin());
static::assertSame(90.0, Latitude::getMax());
}

/**
Expand Down
16 changes: 8 additions & 8 deletions tests/Entities/Coordinates/LongitudeTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ public function it_can_be_instantiated()
{
$long = $this->createLongitude();

$this->assertCoordinateInstance($long);
$this->assertInstanceOf(\Arcanedev\GeoLocation\Entities\Coordinates\Longitude::class, $long);
static::assertCoordinateInstance($long);
static::assertInstanceOf(\Arcanedev\GeoLocation\Entities\Coordinates\Longitude::class, $long);
}

/** @test */
Expand All @@ -31,20 +31,20 @@ public function it_can_get_and_set_value()
$long = $this->createLongitude();
$value = 7.0926;

$this->assertSame($value, $long->getValue());
$this->assertSame($value, $long->value());
static::assertSame($value, $long->getValue());
static::assertSame($value, $long->value());

$long->setValue(0);

$this->assertSame(0.0, $long->getValue());
$this->assertSame(0.0, $long->value());
static::assertSame(0.0, $long->getValue());
static::assertSame(0.0, $long->value());
}

/** @test */
public function it_can_get_min_and_max_values()
{
$this->assertSame(-180.0, Longitude::getMin());
$this->assertSame(180.0, Longitude::getMax());
static::assertSame(-180.0, Longitude::getMin());
static::assertSame(180.0, Longitude::getMax());
}

/**
Expand Down
40 changes: 20 additions & 20 deletions tests/Entities/Coordinates/PositionTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ public function it_can_be_instantiated()
];

foreach ($expectations as $expected) {
$this->assertInstanceOf($expected, $position);
static::assertInstanceOf($expected, $position);
}
}

Expand All @@ -44,49 +44,49 @@ public function it_can_create()
];

foreach ($expectations as $expected) {
$this->assertInstanceOf($expected, $position);
static::assertInstanceOf($expected, $position);
}

$this->assertSame($lat, $position->lat()->value());
$this->assertSame($long, $position->lng()->value());
static::assertSame($lat, $position->lat()->value());
static::assertSame($long, $position->lng()->value());
}

/** @test */
public function it_can_set_and_get_latitude()
{
$position = $this->createPosition();

$this->assertCoordinateInstance($position->getLatitude());
$this->assertCoordinateInstance($position->lat());
static::assertCoordinateInstance($position->getLatitude());
static::assertCoordinateInstance($position->lat());

$this->assertSame(31.7917, $position->getLatitude()->value());
$this->assertSame(31.7917, $position->lat()->value());
static::assertSame(31.7917, $position->getLatitude()->value());
static::assertSame(31.7917, $position->lat()->value());

$lat = $this->createLongitude(12.3456);

$position->setLatitude($lat);

$this->assertSame(12.3456, $position->getLatitude()->value());
$this->assertSame(12.3456, $position->lat()->value());
static::assertSame(12.3456, $position->getLatitude()->value());
static::assertSame(12.3456, $position->lat()->value());
}

/** @test */
public function it_can_set_and_get_longitude()
{
$position = $this->createPosition();

$this->assertCoordinateInstance($position->getLongitude());
$this->assertCoordinateInstance($position->lng());
static::assertCoordinateInstance($position->getLongitude());
static::assertCoordinateInstance($position->lng());

$this->assertSame(7.0926, $position->getLongitude()->value());
$this->assertSame(7.0926, $position->lng()->value());
static::assertSame(7.0926, $position->getLongitude()->value());
static::assertSame(7.0926, $position->lng()->value());

$long = $this->createLongitude(12.3456);

$position->setLongitude($long);

$this->assertSame(12.3456, $position->getLongitude()->value());
$this->assertSame(12.3456, $position->lng()->value());
static::assertSame(12.3456, $position->getLongitude()->value());
static::assertSame(12.3456, $position->lng()->value());
}

/** @test */
Expand All @@ -99,7 +99,7 @@ public function it_can_convert_to_array()
'lng' => 7.0926,
];

$this->assertSame($expected, $position->toArray());
static::assertSame($expected, $position->toArray());
}

/** @test */
Expand All @@ -108,9 +108,9 @@ public function it_can_convert_to_json()
$position = $this->createPosition();
$expected = '{"lat":31.7917,"lng":7.0926}';

$this->assertJson($position->toJson());
static::assertJson($position->toJson());

$this->assertSame($expected, $position->toJson());
$this->assertSame($expected, json_encode($position));
static::assertSame($expected, $position->toJson());
static::assertSame($expected, json_encode($position));
}
}
20 changes: 10 additions & 10 deletions tests/Entities/Coordinates/ViewportTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ public function it_can_be_instantiated()
];

foreach ($expectations as $expected) {
$this->assertInstanceOf($expected, $viewport);
static::assertInstanceOf($expected, $viewport);
}
}

Expand All @@ -44,14 +44,14 @@ public function it_can_create()
];

foreach ($expectations as $expected) {
$this->assertInstanceOf($expected, $viewport);
static::assertInstanceOf($expected, $viewport);
}

$this->assertSame($position->lat()->value(), $viewport->getNorthEast()->lat()->value());
$this->assertSame($position->lng()->value(), $viewport->getNorthEast()->lng()->value());
static::assertSame($position->lat()->value(), $viewport->getNorthEast()->lat()->value());
static::assertSame($position->lng()->value(), $viewport->getNorthEast()->lng()->value());

$this->assertSame($position->lat()->value(), $viewport->getSouthWest()->lat()->value());
$this->assertSame($position->lng()->value(), $viewport->getSouthWest()->lng()->value());
static::assertSame($position->lat()->value(), $viewport->getSouthWest()->lat()->value());
static::assertSame($position->lng()->value(), $viewport->getSouthWest()->lng()->value());
}

/** @test */
Expand All @@ -65,7 +65,7 @@ public function it_can_convert_to_array()
'southwest' => $position->toArray(),
];

$this->assertSame($expected, $viewport->toArray());
static::assertSame($expected, $viewport->toArray());
}

/** @test */
Expand All @@ -76,9 +76,9 @@ public function it_can_convert_to_json()

$expected = '{"northeast":{"lat":31.7917,"lng":7.0926},"southwest":{"lat":31.7917,"lng":7.0926}}';

$this->assertJson($viewport->toJson());
static::assertJson($viewport->toJson());

$this->assertSame($expected, $viewport->toJson());
$this->assertSame($expected, json_encode($viewport));
static::assertSame($expected, $viewport->toJson());
static::assertSame($expected, json_encode($viewport));
}
}
Loading

0 comments on commit 5ad0f5d

Please sign in to comment.