Skip to content

Commit a8f7d5e

Browse files
committed
Update test to work with phpunit 8
1 parent b108d6b commit a8f7d5e

12 files changed

+33
-38
lines changed

tests/Geometries/GeometryCollectionTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ class GeometryCollectionTest extends TestCase
2323
*/
2424
protected $mapper_mock;
2525

26-
public function setUp()
26+
public function setUp(): void
2727
{
2828
parent::setUp();
2929

tests/Geometries/LineStringTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ class LineStringTest extends TestCase
2323
*/
2424
protected $mapper_mock;
2525

26-
public function setUp()
26+
public function setUp(): void
2727
{
2828
parent::setUp();
2929

tests/Geometries/MultiLineStringTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ class MultiLineStringTest extends TestCase
2323
*/
2424
protected $mapper_mock;
2525

26-
public function setUp()
26+
public function setUp(): void
2727
{
2828
parent::setUp();
2929

tests/Geometries/MultiPointTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ class MultiPointTest extends TestCase
2323
*/
2424
protected $mapper_mock;
2525

26-
public function setUp()
26+
public function setUp(): void
2727
{
2828
parent::setUp();
2929

tests/Geometries/MultiPolygonTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ class MultiPolygonTest extends TestCase
2323
*/
2424
protected $mapper_mock;
2525

26-
public function setUp()
26+
public function setUp(): void
2727
{
2828
parent::setUp();
2929

tests/Geometries/PointTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ class PointTest extends TestCase
2323
*/
2424
protected $mapper_mock;
2525

26-
public function setUp()
26+
public function setUp(): void
2727
{
2828
parent::setUp();
2929

tests/Geometries/PolygonTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ class PolygonTest extends TestCase
2323
*/
2424
protected $mapper_mock;
2525

26-
public function setUp()
26+
public function setUp(): void
2727
{
2828
parent::setUp();
2929

tests/GeometryFacadeTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ class GeometryFacadeTest extends TestCase
1212
*/
1313
protected $facade;
1414

15-
public function setUp()
15+
public function setUp(): void
1616
{
1717
parent::setUp();
1818

tests/GeometryServiceProviderTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ class GeometryServiceProviderTest extends TestCase
4141
*/
4242
protected $service_provider;
4343

44-
public function setUp()
44+
public function setUp(): void
4545
{
4646
parent::setUp();
4747

tests/GeometryTest.php

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ class GeometryTest extends TestCase
3232
*/
3333
protected $mapper_mock;
3434

35-
public function setUp()
35+
public function setUp(): void
3636
{
3737
parent::setUp();
3838

@@ -291,21 +291,22 @@ public function it_returns_the_wrapped_point_class_for_geoPHPs_point()
291291

292292
/**
293293
* @test
294-
* @group unit
295-
* @expectedException RuntimeException
296-
* @expectedExceptionMessage Call to undefined method Spinen\Geometry\Geometry::invalidMethod().
297294
*/
298295
public function it_raises_exception_for_undefined_method()
299296
{
297+
$this->expectException(RuntimeException::class);
298+
$this->expectExceptionMessage('Call to undefined method Spinen\Geometry\Geometry::invalidMethod().');
299+
300300
$this->geometry->invalidMethod('data');
301301
}
302302

303303
/**
304304
* @test
305-
* @expectedException InvalidArgumentException
306305
*/
307306
public function it_raises_exception_when_the_data_cannot_be_converted()
308307
{
308+
$this->expectException(InvalidArgumentException::class);
309+
309310
$this->geo_php_mock->shouldReceive('load')
310311
->once()
311312
->withArgs([
@@ -324,19 +325,21 @@ public function it_raises_exception_when_the_data_cannot_be_converted()
324325

325326
/**
326327
* @test
327-
* @expectedException InvalidArgumentException
328328
*/
329329
public function it_raises_exception_when_building_name_to_proxy_class_for_null_geometry()
330330
{
331+
$this->expectException(InvalidArgumentException::class);
332+
331333
$this->geometry->buildGeometryClassName(null);
332334
}
333335

334336
/**
335337
* @test
336-
* @expectedException RuntimeException
337338
*/
338339
public function it_raises_exception_when_building_name_to_proxy_class_that_does_not_exist()
339340
{
341+
$this->expectException(RuntimeException::class);
342+
340343
$this->geometry->buildGeometryClassName($this->geometry);
341344
}
342345
}

tests/Support/GeometryProxyTest.php

Lines changed: 9 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
namespace Spinen\Geometry\Support;
44

55
use Mockery;
6+
use RuntimeException;
67
use Spinen\Geometry\TestCase;
78
use stdClass;
89

@@ -23,7 +24,7 @@ class GeometryProxyTest extends TestCase
2324
*/
2425
protected $mapper_mock;
2526

26-
public function setUp()
27+
public function setUp(): void
2728
{
2829
parent::setUp();
2930

@@ -41,7 +42,6 @@ private function setUpMocks()
4142

4243
/**
4344
* @test
44-
* @group unit
4545
*/
4646
public function it_can_be_constructed()
4747
{
@@ -50,7 +50,6 @@ public function it_can_be_constructed()
5050

5151
/**
5252
* @test
53-
* @group unit
5453
*/
5554
public function it_calls_count_on_geoPHP_geometry_with_the_correct_type_for_the_dynamic_to_methods()
5655
{
@@ -85,7 +84,6 @@ public function it_calls_count_on_geoPHP_geometry_with_the_correct_type_for_the_
8584

8685
/**
8786
* @test
88-
* @group
8987
*/
9088
public function it_returns_the_results_of_a_method_on_the_geometry_if_method_is_not_on_proxy()
9189
{
@@ -101,7 +99,6 @@ public function it_returns_the_results_of_a_method_on_the_geometry_if_method_is_
10199

102100
/**
103101
* @test
104-
* @group unit
105102
*/
106103
public function it_uses_the_geometry_when_available()
107104
{
@@ -117,18 +114,19 @@ public function it_uses_the_geometry_when_available()
117114

118115
/**
119116
* @test
120-
* @group unit
121-
* @expectedException RuntimeException
122-
* @expectedExceptionMessage Call to undefined method Spinen\Geometry\Support\GeometryProxy::invalidMethod().
123117
*/
124118
public function it_raises_exception_for_undefined_method()
125119
{
120+
$this->expectException(RuntimeException::class);
121+
$this->expectExceptionMessage(
122+
'Call to undefined method Spinen\Geometry\Support\GeometryProxy::invalidMethod().'
123+
);
124+
126125
$this->geometry_proxy->invalidMethod();
127126
}
128127

129128
/**
130129
* @test
131-
* @group unit
132130
*/
133131
public function it_returns_the_json_when_casted_as_a_string()
134132
{
@@ -149,7 +147,6 @@ public function it_returns_the_json_when_casted_as_a_string()
149147

150148
/**
151149
* @test
152-
* @group unit
153150
*/
154151
public function it_returns_a_cached_array()
155152
{
@@ -171,7 +168,6 @@ public function it_returns_a_cached_array()
171168

172169
/**
173170
* @test
174-
* @group unit
175171
*/
176172
public function it_exposes_the_geometry_properties_as_its_own()
177173
{
@@ -192,11 +188,11 @@ public function it_exposes_the_geometry_properties_as_its_own()
192188

193189
/**
194190
* @test
195-
* @group unit
196-
* @expectedException RuntimeException
197191
*/
198192
public function it_raises_exception_getting_non_existing_property()
199193
{
194+
$this->expectException(RuntimeException::class);
195+
200196
$this->geometry_mock->shouldReceive('out')
201197
->once()
202198
->with('json')
@@ -212,7 +208,6 @@ public function it_raises_exception_getting_non_existing_property()
212208

213209
/**
214210
* @test
215-
* @group unit
216211
*/
217212
public function it_calculates_the_acres_of_a_polygon()
218213
{
@@ -257,7 +252,6 @@ public function it_calculates_the_acres_of_a_polygon()
257252

258253
/**
259254
* @test
260-
* @group unit
261255
*/
262256
public function it_returns_zero_if_polygon_does_not_have_three_points()
263257
{
@@ -278,7 +272,6 @@ public function it_returns_zero_if_polygon_does_not_have_three_points()
278272

279273
/**
280274
* @test
281-
* @group unit
282275
*/
283276
public function it_returns_the_raw_geometry()
284277
{

tests/Support/TypeMapperTest.php

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
namespace Spinen\Geometry\Support;
44

5+
use InvalidArgumentException;
56
use Mockery;
67
use Spinen\Geometry\TestCase;
78

@@ -12,7 +13,7 @@ class TypeMapperTest extends TestCase
1213
*/
1314
protected $mapper;
1415

15-
public function setUp()
16+
public function setUp(): void
1617
{
1718
parent::setUp();
1819

@@ -21,7 +22,6 @@ public function setUp()
2122

2223
/**
2324
* @test
24-
* @group unit
2525
*/
2626
public function it_can_be_constructed()
2727
{
@@ -30,7 +30,6 @@ public function it_can_be_constructed()
3030

3131
/**
3232
* @test
33-
* @group
3433
*/
3534
public function it_returns_the_expected_types()
3635
{
@@ -55,12 +54,12 @@ public function it_returns_the_expected_types()
5554

5655
/**
5756
* @test
58-
* @group unit
59-
* @expectedException InvalidArgumentException
60-
* @expectedExceptionMessage Unknown geometry type of [InvalidType] was provided.
6157
*/
6258
public function it_raises_exception_for_undefined_parse_type()
6359
{
60+
$this->expectException(InvalidArgumentException::class);
61+
$this->expectExceptionMessage('Unknown geometry type of [InvalidType] was provided.');
62+
6463
$this->mapper->map('InvalidType');
6564
}
6665
}

0 commit comments

Comments
 (0)