Skip to content

v4.0.0 (Laravel 8 / MySQL 8) #148

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

Merged
merged 8 commits into from
Sep 21, 2020
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
Prev Previous commit
Next Next commit
Prep for Laravel 8
- Removed PHP versions prior to 7.3
- Upgraded mockery to ^1.3 and phpunit to ~6.5
- Using php-coveralls.phar instead of installing as dev dependency (fixes issue with Guzzle 6 vs 7)
- Updated tests 🥼 🧪
- Updated README.md 📖
  • Loading branch information
grimzy committed Sep 21, 2020
commit 04e061526870a2d046eac9e31edee1ab0808f27e
10 changes: 4 additions & 6 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,12 +1,8 @@
language: php

php:
- '5.5'
- '5.6'
- '7.0'
- '7.1'
- '7.2'
- '7.3'
- '7.4'

env:
- MYSQL_VERSION=8.0
Expand All @@ -30,10 +26,12 @@ before_script:
- curl -L https://codeclimate.com/downloads/test-reporter/test-reporter-latest-linux-amd64 > ./cc-test-reporter
- chmod +x ./cc-test-reporter
- ./cc-test-reporter before-build
- curl -L https://github.com/php-coveralls/php-coveralls/releases/download/v2.2.0/php-coveralls.phar > ./php-coveralls.phar
- chmod +x php-coveralls.phar

script: vendor/bin/phpunit --coverage-clover build/logs/clover.xml

after_script:
- php vendor/bin/coveralls -v
- ./php-coveralls.phar -v
- ./cc-test-reporter after-build --coverage-input-type clover --exit-code $TRAVIS_TEST_RESULT

3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@ Please check the documentation for your MySQL version. MySQL's Extension for Spa

- `1.x.x`: MySQL 5.6 (also supports MySQL 5.5 but not all spatial analysis functions)
- `2.x.x`: MySQL 5.7
- **`3.x.x`: MySQL 8.0 with SRID support (Current branch)**
- `3.x.x`: MySQL 8.0 with SRID support (Laravel version < 8.0)
- **`4.x.x`: MySQL 8.0 with SRID support (Laravel 8+) [Current branch]**

This package also works with MariaDB. Please refer to the [MySQL/MariaDB Spatial Support Matrix](https://mariadb.com/kb/en/library/mysqlmariadb-spatial-support-matrix/) for compatibility.

Expand Down
9 changes: 4 additions & 5 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,20 +15,19 @@
}
],
"require": {
"php": ">=5.5.9",
"php": ">=7.3",
"ext-pdo": "*",
"ext-json": "*",
"illuminate/database": "^5.2|^6.0|^7.0",
"geo-io/wkb-parser": "^1.0",
"jmikola/geojson": "^1.0"
},
"require-dev": {
"phpunit/phpunit": "~4.8|~5.7",
"mockery/mockery": "^0.9.9",
"phpunit/phpunit": "~6.5",
"laravel/laravel": "^5.2|^6.0|^7.0",
"doctrine/dbal": "^2.5",
"laravel/browser-kit-testing": "^2.0",
"php-coveralls/php-coveralls": "^2.0"
"mockery/mockery": "^1.3"
},
"autoload": {
"psr-4": {
Expand All @@ -43,7 +42,7 @@
},
"extra": {
"branch-alias": {
"dev-master": "3.0.x-dev"
"dev-master": "4.0.x-dev"
},
"laravel": {
"providers": [
Expand Down
4 changes: 3 additions & 1 deletion tests/Unit/BaseTestCase.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
<?php

abstract class BaseTestCase extends PHPUnit_Framework_TestCase
use PHPUnit\Framework\TestCase;

abstract class BaseTestCase extends TestCase
{
public function tearDown()
{
Expand Down
42 changes: 30 additions & 12 deletions tests/Unit/Eloquent/BuilderTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,12 @@ public function testUpdatePoint()
$this->queryBuilder
->shouldReceive('update')
->with(['point' => new SpatialExpression($point)])
->once();
->once()
->andReturn(1);

$result = $this->builder->update(['point' => $point]);

$this->builder->update(['point' => $point]);
$this->assertSame(1, $result);
}

public function testUpdateLinestring()
Expand All @@ -53,9 +56,12 @@ public function testUpdateLinestring()
$this->queryBuilder
->shouldReceive('update')
->with(['linestring' => new SpatialExpression($linestring)])
->once();
->once()
->andReturn(1);

$this->builder->update(['linestring' => $linestring]);
$result = $this->builder->update(['linestring' => $linestring]);

$this->assertSame(1, $result);
}

public function testUpdatePolygon()
Expand All @@ -68,9 +74,12 @@ public function testUpdatePolygon()
$this->queryBuilder
->shouldReceive('update')
->with(['polygon' => new SpatialExpression($polygon)])
->once();
->once()
->andReturn(1);

$result = $this->builder->update(['polygon' => $polygon]);

$this->builder->update(['polygon' => $polygon]);
$this->assertSame(1, $result);
}

public function testUpdatePointWithSrid()
Expand All @@ -79,9 +88,12 @@ public function testUpdatePointWithSrid()
$this->queryBuilder
->shouldReceive('update')
->with(['point' => new SpatialExpression($point)])
->once();
->once()
->andReturn(1);

$result = $this->builder->update(['point' => $point]);

$this->builder->update(['point' => $point]);
$this->assertSame(1, $result);
}

public function testUpdateLinestringWithSrid()
Expand All @@ -91,9 +103,12 @@ public function testUpdateLinestringWithSrid()
$this->queryBuilder
->shouldReceive('update')
->with(['linestring' => new SpatialExpression($linestring)])
->once();
->once()
->andReturn(1);

$this->builder->update(['linestring' => $linestring]);
$result = $this->builder->update(['linestring' => $linestring]);

$this->assertSame(1, $result);
}

public function testUpdatePolygonWithSrid()
Expand All @@ -106,9 +121,12 @@ public function testUpdatePolygonWithSrid()
$this->queryBuilder
->shouldReceive('update')
->with(['polygon' => new SpatialExpression($polygon)])
->once();
->once()
->andReturn(1);

$result = $this->builder->update(['polygon' => $polygon]);

$this->builder->update(['polygon' => $polygon]);
$this->assertSame(1, $result);
}
}

Expand Down
8 changes: 7 additions & 1 deletion tests/Unit/Eloquent/SpatialTraitTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,12 @@
use Grimzy\LaravelMysqlSpatial\Types\Point;
use Illuminate\Database\Eloquent\Model;
use Mockery as m;
use Mockery\Adapter\Phpunit\MockeryPHPUnitIntegration;

class SpatialTraitTest extends BaseTestCase
{
use MockeryPHPUnitIntegration;

/**
* @var TestModel
*/
Expand Down Expand Up @@ -217,7 +220,10 @@ public function testSettingRawAttributes()
public function testSpatialFieldsNotDefinedException()
{
$model = new TestNoSpatialModel();
$this->setExpectedException(SpatialFieldsNotDefinedException::class);
$this->assertException(
SpatialFieldsNotDefinedException::class,
'TestNoSpatialModel has to define $spatialFields'
);
$model->getSpatialFields();
}

Expand Down
3 changes: 2 additions & 1 deletion tests/Unit/MysqlConnectionTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,10 @@

use Grimzy\LaravelMysqlSpatial\MysqlConnection;
use Grimzy\LaravelMysqlSpatial\Schema\Builder;
use PHPUnit\Framework\TestCase;
use Stubs\PDOStub;

class MysqlConnectionTest extends PHPUnit_Framework_TestCase
class MysqlConnectionTest extends TestCase
{
private $mysqlConnection;

Expand Down
Loading