Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 04e0615

Browse files
committed
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 📖
1 parent 49b0daf commit 04e0615

13 files changed

+249
-64
lines changed

‎.travis.yml‎

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,8 @@
11
language: php
22

33
php:
4-
- '5.5'
5-
- '5.6'
6-
- '7.0'
7-
- '7.1'
8-
- '7.2'
94
- '7.3'
5+
- '7.4'
106

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

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

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

‎README.md‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,8 @@ Please check the documentation for your MySQL version. MySQL's Extension for Spa
1414

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

1920
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.
2021

‎composer.json‎

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,20 +15,19 @@
1515
}
1616
],
1717
"require": {
18-
"php": ">=5.5.9",
18+
"php": ">=7.3",
1919
"ext-pdo": "*",
2020
"ext-json": "*",
2121
"illuminate/database": "^5.2|^6.0|^7.0",
2222
"geo-io/wkb-parser": "^1.0",
2323
"jmikola/geojson": "^1.0"
2424
},
2525
"require-dev": {
26-
"phpunit/phpunit": "~4.8|~5.7",
27-
"mockery/mockery": "^0.9.9",
26+
"phpunit/phpunit": "~6.5",
2827
"laravel/laravel": "^5.2|^6.0|^7.0",
2928
"doctrine/dbal": "^2.5",
3029
"laravel/browser-kit-testing": "^2.0",
31-
"php-coveralls/php-coveralls": "^2.0"
30+
"mockery/mockery": "^1.3"
3231
},
3332
"autoload": {
3433
"psr-4": {
@@ -43,7 +42,7 @@
4342
},
4443
"extra": {
4544
"branch-alias": {
46-
"dev-master": "3.0.x-dev"
45+
"dev-master": "4.0.x-dev"
4746
},
4847
"laravel": {
4948
"providers": [

‎tests/Unit/BaseTestCase.php‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
<?php
22

3-
abstract class BaseTestCase extends PHPUnit_Framework_TestCase
3+
use PHPUnit\Framework\TestCase;
4+
5+
abstract class BaseTestCase extends TestCase
46
{
57
public function tearDown()
68
{

‎tests/Unit/Eloquent/BuilderTest.php‎

Lines changed: 30 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -41,9 +41,12 @@ public function testUpdatePoint()
4141
$this->queryBuilder
4242
->shouldReceive('update')
4343
->with(['point' => new SpatialExpression($point)])
44-
->once();
44+
->once()
45+
->andReturn(1);
46+
47+
$result = $this->builder->update(['point' => $point]);
4548

46-
$this->builder->update(['point' => $point]);
49+
$this->assertSame(1, $result);
4750
}
4851

4952
public function testUpdateLinestring()
@@ -53,9 +56,12 @@ public function testUpdateLinestring()
5356
$this->queryBuilder
5457
->shouldReceive('update')
5558
->with(['linestring' => new SpatialExpression($linestring)])
56-
->once();
59+
->once()
60+
->andReturn(1);
5761

58-
$this->builder->update(['linestring' => $linestring]);
62+
$result = $this->builder->update(['linestring' => $linestring]);
63+
64+
$this->assertSame(1, $result);
5965
}
6066

6167
public function testUpdatePolygon()
@@ -68,9 +74,12 @@ public function testUpdatePolygon()
6874
$this->queryBuilder
6975
->shouldReceive('update')
7076
->with(['polygon' => new SpatialExpression($polygon)])
71-
->once();
77+
->once()
78+
->andReturn(1);
79+
80+
$result = $this->builder->update(['polygon' => $polygon]);
7281

73-
$this->builder->update(['polygon' => $polygon]);
82+
$this->assertSame(1, $result);
7483
}
7584

7685
public function testUpdatePointWithSrid()
@@ -79,9 +88,12 @@ public function testUpdatePointWithSrid()
7988
$this->queryBuilder
8089
->shouldReceive('update')
8190
->with(['point' => new SpatialExpression($point)])
82-
->once();
91+
->once()
92+
->andReturn(1);
93+
94+
$result = $this->builder->update(['point' => $point]);
8395

84-
$this->builder->update(['point' => $point]);
96+
$this->assertSame(1, $result);
8597
}
8698

8799
public function testUpdateLinestringWithSrid()
@@ -91,9 +103,12 @@ public function testUpdateLinestringWithSrid()
91103
$this->queryBuilder
92104
->shouldReceive('update')
93105
->with(['linestring' => new SpatialExpression($linestring)])
94-
->once();
106+
->once()
107+
->andReturn(1);
95108

96-
$this->builder->update(['linestring' => $linestring]);
109+
$result = $this->builder->update(['linestring' => $linestring]);
110+
111+
$this->assertSame(1, $result);
97112
}
98113

99114
public function testUpdatePolygonWithSrid()
@@ -106,9 +121,12 @@ public function testUpdatePolygonWithSrid()
106121
$this->queryBuilder
107122
->shouldReceive('update')
108123
->with(['polygon' => new SpatialExpression($polygon)])
109-
->once();
124+
->once()
125+
->andReturn(1);
126+
127+
$result = $this->builder->update(['polygon' => $polygon]);
110128

111-
$this->builder->update(['polygon' => $polygon]);
129+
$this->assertSame(1, $result);
112130
}
113131
}
114132

‎tests/Unit/Eloquent/SpatialTraitTest.php‎

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,12 @@
55
use Grimzy\LaravelMysqlSpatial\Types\Point;
66
use Illuminate\Database\Eloquent\Model;
77
use Mockery as m;
8+
use Mockery\Adapter\Phpunit\MockeryPHPUnitIntegration;
89

910
class SpatialTraitTest extends BaseTestCase
1011
{
12+
use MockeryPHPUnitIntegration;
13+
1114
/**
1215
* @var TestModel
1316
*/
@@ -217,7 +220,10 @@ public function testSettingRawAttributes()
217220
public function testSpatialFieldsNotDefinedException()
218221
{
219222
$model = new TestNoSpatialModel();
220-
$this->setExpectedException(SpatialFieldsNotDefinedException::class);
223+
$this->assertException(
224+
SpatialFieldsNotDefinedException::class,
225+
'TestNoSpatialModel has to define $spatialFields'
226+
);
221227
$model->getSpatialFields();
222228
}
223229

‎tests/Unit/MysqlConnectionTest.php‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,10 @@
22

33
use Grimzy\LaravelMysqlSpatial\MysqlConnection;
44
use Grimzy\LaravelMysqlSpatial\Schema\Builder;
5+
use PHPUnit\Framework\TestCase;
56
use Stubs\PDOStub;
67

7-
class MysqlConnectionTest extends PHPUnit_Framework_TestCase
8+
class MysqlConnectionTest extends TestCase
89
{
910
private $mysqlConnection;
1011

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /