Skip to content

Commit 1db05ca

Browse files
committed
fix tests
change creds doctrine/dbal mysql creds bump mysql mysql ext change mysql sleep run against PRs sleep mysql call parent use mysql 8 use delta comparison use delta disable fail-fast cleanup dbal conflict fail fast
1 parent 266a036 commit 1db05ca

File tree

12 files changed

+70
-129
lines changed

12 files changed

+70
-129
lines changed

.github/workflows/fix-php-code-style-issues.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,9 @@ name: Fix PHP code style issues
33
on:
44
push:
55
paths:
6-
- '**.php'
6+
- "**.php"
7+
pull_request:
8+
branches: [master]
79

810
jobs:
911
php-code-styling:

.github/workflows/phpstan.yml

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,10 @@ name: PHPStan
33
on:
44
push:
55
paths:
6-
- '**.php'
7-
- 'phpstan.neon.dist'
6+
- "**.php"
7+
- "phpstan.neon.dist"
8+
pull_request:
9+
branches: [master]
810

911
jobs:
1012
phpstan:
@@ -16,7 +18,7 @@ jobs:
1618
- name: Setup PHP
1719
uses: shivammathur/setup-php@v2
1820
with:
19-
php-version: '8.1'
21+
php-version: "8.1"
2022
coverage: none
2123

2224
- name: Install composer dependencies

.github/workflows/run-tests.yml

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -24,11 +24,10 @@ jobs:
2424
name: P${{ matrix.php }} - L${{ matrix.laravel }} - ${{ matrix.stability }} - ${{ matrix.os }}
2525

2626
steps:
27-
- uses: mirromutth/[email protected]
28-
with:
29-
mysql version: "8.0"
30-
mysql user: "user"
31-
mysql password: "password"
27+
- name: Set up MySQL
28+
run: |
29+
sudo /etc/init.d/mysql start
30+
mysql -e 'CREATE DATABASE laravel' -uroot -proot
3231
3332
- name: Checkout code
3433
uses: actions/checkout@v3
@@ -37,7 +36,7 @@ jobs:
3736
uses: shivammathur/setup-php@v2
3837
with:
3938
php-version: ${{ matrix.php }}
40-
extensions: dom, curl, libxml, mbstring, zip, pcntl, pdo, sqlite, pdo_sqlite, bcmath, soap, intl, gd, exif, iconv, imagick, fileinfo
39+
extensions: dom, curl, libxml, mbstring, zip, pcntl, pdo, sqlite, pdo_sqlite, bcmath, soap, intl, gd, exif, iconv, imagick, fileinfo, mysql
4140
coverage: none
4241

4342
- name: Setup problem matchers

Makefile

Lines changed: 0 additions & 32 deletions
This file was deleted.

composer.json

Lines changed: 17 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -19,25 +19,29 @@
1919
],
2020
"require": {
2121
"php": "^8.1",
22-
"ext-pdo": "*",
2322
"ext-json": "*",
23+
"ext-pdo": "*",
24+
"doctrine/dbal": "^2.5",
25+
"geo-io/wkb-parser": "^1.0",
2426
"illuminate/contracts": "^9.0",
2527
"illuminate/database": "^9.0",
26-
"geo-io/wkb-parser": "^1.0",
2728
"jmikola/geojson": "^1.0"
2829
},
30+
"conflict": {
31+
"doctrine/dbal": "2.13.*"
32+
},
2933
"require-dev": {
30-
"laravel/pint": "^1.0",
31-
"laravel/laravel": "^9.0",
32-
"laravel/browser-kit-testing": "^6.0",
33-
"mockery/mockery": "^1.3",
34-
"nunomaduro/collision": "^6.0",
35-
"nunomaduro/larastan": "^2.0.1",
36-
"orchestra/testbench": "^7.0",
37-
"phpstan/extension-installer": "^1.1",
38-
"phpstan/phpstan-deprecation-rules": "^1.0",
39-
"phpstan/phpstan-phpunit": "^1.0",
40-
"phpunit/phpunit": "^9.5"
34+
"laravel/pint": "^1.5",
35+
"laravel/laravel": "^9.5.2",
36+
"laravel/browser-kit-testing": "^6.4",
37+
"mockery/mockery": "^1.5.1",
38+
"nunomaduro/collision": "^6.4",
39+
"nunomaduro/larastan": "^2.4.1",
40+
"orchestra/testbench": "^7.22",
41+
"phpstan/extension-installer": "^1.2",
42+
"phpstan/phpstan-deprecation-rules": "^1.1.1",
43+
"phpstan/phpstan-phpunit": "^1.3.4",
44+
"phpunit/phpunit": "^9.6.3"
4145
},
4246
"autoload": {
4347
"psr-4": {

docker-compose.yml

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
version: '3.3'
22
services:
33
db:
4-
image: mysql:5.7
5-
ports:
6-
- "3306:3306"
7-
environment:
8-
MYSQL_DATABASE: 'spatial_test'
9-
MYSQL_ROOT_PASSWORD: ''
10-
MYSQL_ALLOW_EMPTY_PASSWORD: 1
4+
image: mysql:8.0
5+
ports:
6+
- "33306:3306"
7+
environment:
8+
MYSQL_DATABASE: 'laravel'
9+
MYSQL_ROOT_PASSWORD: 'root'
10+
MYSQL_ALLOW_EMPTY_PASSWORD: 1

phpunit.xml.dist

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,10 +46,10 @@
4646
<env name="CACHE_DRIVER" value="array"/>
4747
<env name="SESSION_DRIVER" value="array"/>
4848
<env name="QUEUE_DRIVER" value="sync"/>
49-
<env name="DB_DATABASE" value="test"/>
49+
<env name="DB_DATABASE" value="laravel"/>
5050
<env name="DB_HOST" value="127.0.0.1"/>
5151
<env name="DB_PORT" value="3306"/>
5252
<env name="DB_USERNAME" value="root"/>
53-
<env name="DB_PASSWORD" value=""/>
53+
<env name="DB_PASSWORD" value="root"/>
5454
</php>
5555
</phpunit>

src/SpatialServiceProvider.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,8 @@ class SpatialServiceProvider extends DatabaseServiceProvider
2727
*/
2828
public function register()
2929
{
30+
parent::register();
31+
3032
// The connection factory is used to create the actual connection instances on
3133
// the database. We will inject the factory into the manager so that it may
3234
// make the connections while they are actually needed and not of before.

tests/Integration/SpatialTest.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -212,7 +212,7 @@ public function testDistanceValue()
212212
$a = GeometryModel::distanceValue('location', $loc1->location)->get();
213213
$this->assertCount(2, $a);
214214
$this->assertEquals(0, $a[0]->distance);
215-
$this->assertEquals(1.4142135623, $a[1]->distance); // PHP floats' 11th+ digits don't matter
215+
$this->assertEqualsWithDelta(1.4142135623, $a[1]->distance, 0.00000001); // PHP floats' 11th+ digits don't matter
216216
}
217217

218218
public function testDistanceSphereValue()
@@ -230,9 +230,9 @@ public function testDistanceSphereValue()
230230
$this->assertEquals(0, $a[0]->distance);
231231

232232
if ($this->after_fix) {
233-
$this->assertEquals(44.7414064842, $a[1]->distance); // PHP floats' 11th+ digits don't matter
233+
$this->assertEqualsWithDelta(44.7414064842, $a[1]->distance, 0.00000001); // PHP floats' 11th+ digits don't matter
234234
} else {
235-
$this->assertEquals(44.7414064845, $a[1]->distance); // PHP floats' 11th+ digits don't matter
235+
$this->assertEqualsWithDelta(44.7414064845, $a[1]->distance, 0.00000001); // PHP floats' 11th+ digits don't matter
236236
}
237237
}
238238

tests/TestCase.php

Lines changed: 0 additions & 36 deletions
This file was deleted.

0 commit comments

Comments
 (0)