Skip to content

Commit bf6a295

Browse files
MatanYadaevMatan Yadaev
andauthored
Upgrade to Pest 2 (#88)
* upgrade to pest 2 * Fix PHPStan --------- Co-authored-by: Matan Yadaev <[email protected]>
1 parent 8a98223 commit bf6a295

File tree

5 files changed

+21
-48
lines changed

5 files changed

+21
-48
lines changed

composer.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,8 @@
2222
"jubeki/laravel-code-style": "^1.2",
2323
"nunomaduro/larastan": "^1.0|^2.4",
2424
"orchestra/testbench": "^8.0",
25-
"pestphp/pest": "^1.22.4",
26-
"pestphp/pest-plugin-laravel": "^1.4"
25+
"pestphp/pest": "^2.0",
26+
"pestphp/pest-plugin-laravel": "^2.0"
2727
},
2828
"autoload": {
2929
"psr-4": {

phpstan.neon

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -7,15 +7,5 @@ parameters:
77
excludePaths:
88
- src/Factory.php
99
level: max
10-
ignoreErrors:
11-
-
12-
message: '#^Call to an undefined method Pest\\Expectation\|Pest\\Support\\Extendable\:\:.+\(\)\.$#'
13-
path: tests/*.php
14-
-
15-
message: '#^Access to an undefined property Pest\\Expectation\|Pest\\Support\\Extendable\:\:\$.+\.$#'
16-
path: tests/*.php
17-
-
18-
message: '#^Call to an undefined method Pest\\Expectation\:\:.+\(\)\.$#'
19-
path: tests/*.php
2010
checkMissingIterableValueType: true
2111
checkGenericClassInNonGenericObjectType: false

phpunit.xml

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,13 @@
11
<?xml version="1.0" encoding="UTF-8"?>
2-
<phpunit backupGlobals="false"
3-
backupStaticAttributes="false"
2+
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
3+
backupGlobals="false"
44
bootstrap="vendor/autoload.php"
55
colors="true"
6-
convertErrorsToExceptions="true"
7-
convertNoticesToExceptions="true"
8-
convertWarningsToExceptions="true"
96
processIsolation="false"
107
stopOnFailure="false"
11-
verbose="true"
8+
xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/10.0/phpunit.xsd"
9+
cacheDirectory=".phpunit.cache"
10+
backupStaticProperties="false"
1211
>
1312
<testsuites>
1413
<testsuite name="Test Suite">

tests/DoctrineTypesTest.php

Lines changed: 14 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
<?php
22

3+
use Doctrine\DBAL\Types\Type;
34
use Illuminate\Support\Facades\DB;
45
use MatanYadaev\EloquentSpatial\Doctrine\GeometryCollectionType;
56
use MatanYadaev\EloquentSpatial\Doctrine\LineStringType;
@@ -9,36 +10,20 @@
910
use MatanYadaev\EloquentSpatial\Doctrine\PointType;
1011
use MatanYadaev\EloquentSpatial\Doctrine\PolygonType;
1112

12-
it('uses custom Doctrine types for spatial columns', function (): void {
13+
it('uses custom Doctrine types for spatial columns', function (string $column, string $typeClass, string $typeName): void {
14+
/** @var class-string<Type> $typeClass */
1315
$doctrineSchemaManager = DB::connection()->getDoctrineSchemaManager();
1416

1517
$columns = $doctrineSchemaManager->listTableColumns('test_places');
1618

17-
expect($columns['point']->getType())
18-
->toBeInstanceOf(PointType::class)
19-
->getName()->toBe('point');
20-
21-
expect($columns['line_string']->getType())
22-
->toBeInstanceOf(LineStringType::class)
23-
->getName()->toBe('linestring');
24-
25-
expect($columns['multi_point']->getType())
26-
->toBeInstanceOf(MultiPointType::class)
27-
->getName()->toBe('multipoint');
28-
29-
expect($columns['polygon']->getType())
30-
->toBeInstanceOf(PolygonType::class)
31-
->getName()->toBe('polygon');
32-
33-
expect($columns['multi_line_string']->getType())
34-
->toBeInstanceOf(MultiLineStringType::class)
35-
->getName()->toBe('multilinestring');
36-
37-
expect($columns['multi_polygon']->getType())
38-
->toBeInstanceOf(MultiPolygonType::class)
39-
->getName()->toBe('multipolygon');
40-
41-
expect($columns['geometry_collection']->getType())
42-
->toBeInstanceOf(GeometryCollectionType::class)
43-
->getName()->toBe('geometrycollection');
44-
});
19+
expect($columns[$column]->getType())->toBeInstanceOf($typeClass)
20+
->and($columns[$column]->getType()->getName())->toBe($typeName);
21+
})->with([
22+
'point' => ['point', PointType::class, 'point'],
23+
'line_string' => ['line_string', LineStringType::class, 'linestring'],
24+
'multi_point' => ['multi_point', MultiPointType::class, 'multipoint'],
25+
'polygon' => ['polygon', PolygonType::class, 'polygon'],
26+
'multi_line_string' => ['multi_line_string', MultiLineStringType::class, 'multilinestring'],
27+
'multi_polygon' => ['multi_polygon', MultiPolygonType::class, 'multipolygon'],
28+
'geometry_collection' => ['geometry_collection', GeometryCollectionType::class, 'geometrycollection'],
29+
]);

tests/GeometryCastTest.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,6 @@
3737
expect(function () use ($testPlace, $pointFromAttributes): void {
3838
$testPlace->update(['point' => $pointFromAttributes]);
3939
})->not->toThrow(InvalidArgumentException::class);
40-
expect(true)->toBeTrue(); // because of Pest's bug: https://github.com/pestphp/pest/issues/657
4140
});
4241

4342
it('updates a model record with null geometry', function (): void {

0 commit comments

Comments
 (0)