Skip to content

Commit 11798bd

Browse files
committed
Style CI fix 🎭
(cherry picked from commit d5fa308)
1 parent 5c5d2c9 commit 11798bd

File tree

5 files changed

+89
-177
lines changed

5 files changed

+89
-177
lines changed

tests/Unit/Types/GeometryCollectionTest.php

Lines changed: 14 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -21,50 +21,43 @@ public function testFromWKT()
2121

2222
public function testToWKT()
2323
{
24-
$this->assertEquals(
25-
'GEOMETRYCOLLECTION(LINESTRING(0 0,1 0,1 1,0 1,0 0),POINT(200 100))',
26-
$this->getGeometryCollection()->toWKT()
27-
);
24+
$this->assertEquals('GEOMETRYCOLLECTION(LINESTRING(0 0,1 0,1 1,0 1,0 0),POINT(200 100))', $this->getGeometryCollection()->toWKT());
2825
}
2926

3027
public function testJsonSerialize()
3128
{
32-
$this->assertInstanceOf(
33-
\GeoJson\Geometry\GeometryCollection::class,
34-
$this->getGeometryCollection()->jsonSerialize()
35-
);
29+
$this->assertInstanceOf(\GeoJson\Geometry\GeometryCollection::class, $this->getGeometryCollection()->jsonSerialize());
3630

37-
$this->assertSame(
38-
'{"type":"GeometryCollection","geometries":[{"type":"LineString","coordinates":[[0,0],[1,0],[1,1],[0,1],[0,0]]},{"type":"Point","coordinates":[200,100]}]}',
39-
json_encode($this->getGeometryCollection()->jsonSerialize())
40-
);
31+
$this->assertSame('{"type":"GeometryCollection","geometries":[{"type":"LineString","coordinates":[[0,0],[1,0],[1,1],[0,1],[0,0]]},{"type":"Point","coordinates":[200,100]}]}', json_encode($this->getGeometryCollection()->jsonSerialize()));
4132
}
4233

43-
public function testInvalidArgumentExceptionNotArrayGeometries() {
34+
public function testInvalidArgumentExceptionNotArrayGeometries()
35+
{
4436
$this->assertException(InvalidArgumentException::class);
4537
$geometrycollection = new GeometryCollection([
4638
$this->getPoint(),
47-
1
39+
1,
4840
]);
4941
}
5042

51-
private function getGeometryCollection() {
43+
private function getGeometryCollection()
44+
{
5245
return new GeometryCollection([$this->getLineString(), $this->getPoint()]);
5346
}
5447

55-
private function getLineString() {
56-
return new LineString(
57-
[
48+
private function getLineString()
49+
{
50+
return new LineString([
5851
new Point(0, 0),
5952
new Point(0, 1),
6053
new Point(1, 1),
6154
new Point(1, 0),
6255
new Point(0, 0),
63-
]
64-
);
56+
]);
6557
}
6658

67-
private function getPoint() {
59+
private function getPoint()
60+
{
6861
return new Point(100, 200);
6962
}
7063
}

tests/Unit/Types/GeometryTest.php

Lines changed: 24 additions & 97 deletions
Original file line numberDiff line numberDiff line change
@@ -14,115 +14,42 @@ class GeometryTest extends BaseTestCase
1414
{
1515
public function testGetWKTArgument()
1616
{
17-
$this->assertEquals(
18-
'0 0',
19-
Geometry::getWKTArgument('POINT(0 0)')
20-
);
21-
$this->assertEquals(
22-
'0 0,1 1,1 2',
23-
Geometry::getWKTArgument('LINESTRING(0 0,1 1,1 2)')
24-
);
25-
$this->assertEquals(
26-
'(0 0,4 0,4 4,0 4,0 0),(1 1, 2 1, 2 2, 1 2,1 1)',
27-
Geometry::getWKTArgument('POLYGON((0 0,4 0,4 4,0 4,0 0),(1 1, 2 1, 2 2, 1 2,1 1))')
28-
);
29-
$this->assertEquals(
30-
'(0 0),(1 2)',
31-
Geometry::getWKTArgument('MULTIPOINT((0 0),(1 2))')
32-
);
33-
$this->assertEquals(
34-
'(0 0,1 1,1 2),(2 3,3 2,5 4)',
35-
Geometry::getWKTArgument('MULTILINESTRING((0 0,1 1,1 2),(2 3,3 2,5 4))')
36-
);
37-
$this->assertEquals(
38-
'((0 0,4 0,4 4,0 4,0 0),(1 1,2 1,2 2,1 2,1 1)), ((-1 -1,-1 -2,-2 -2,-2 -1,-1 -1))',
39-
Geometry::getWKTArgument('MULTIPOLYGON(((0 0,4 0,4 4,0 4,0 0),(1 1,2 1,2 2,1 2,1 1)), ((-1 -1,-1 -2,-2 -2,-2 -1,-1 -1)))')
40-
);
41-
$this->assertEquals(
42-
'POINT(2 3),LINESTRING(2 3,3 4)',
43-
Geometry::getWKTArgument('GEOMETRYCOLLECTION(POINT(2 3),LINESTRING(2 3,3 4))')
44-
);
17+
$this->assertEquals('0 0', Geometry::getWKTArgument('POINT(0 0)'));
18+
$this->assertEquals('0 0,1 1,1 2', Geometry::getWKTArgument('LINESTRING(0 0,1 1,1 2)'));
19+
$this->assertEquals('(0 0,4 0,4 4,0 4,0 0),(1 1, 2 1, 2 2, 1 2,1 1)', Geometry::getWKTArgument('POLYGON((0 0,4 0,4 4,0 4,0 0),(1 1, 2 1, 2 2, 1 2,1 1))'));
20+
$this->assertEquals('(0 0),(1 2)', Geometry::getWKTArgument('MULTIPOINT((0 0),(1 2))'));
21+
$this->assertEquals('(0 0,1 1,1 2),(2 3,3 2,5 4)', Geometry::getWKTArgument('MULTILINESTRING((0 0,1 1,1 2),(2 3,3 2,5 4))'));
22+
$this->assertEquals('((0 0,4 0,4 4,0 4,0 0),(1 1,2 1,2 2,1 2,1 1)), ((-1 -1,-1 -2,-2 -2,-2 -1,-1 -1))', Geometry::getWKTArgument('MULTIPOLYGON(((0 0,4 0,4 4,0 4,0 0),(1 1,2 1,2 2,1 2,1 1)), ((-1 -1,-1 -2,-2 -2,-2 -1,-1 -1)))'));
23+
$this->assertEquals('POINT(2 3),LINESTRING(2 3,3 4)', Geometry::getWKTArgument('GEOMETRYCOLLECTION(POINT(2 3),LINESTRING(2 3,3 4))'));
4524
}
4625

4726
public function testGetWKTClass()
4827
{
49-
$this->assertEquals(
50-
Point::class,
51-
Geometry::getWKTClass('POINT(0 0)')
52-
);
53-
$this->assertEquals(
54-
LineString::class,
55-
Geometry::getWKTClass('LINESTRING(0 0,1 1,1 2)')
56-
);
57-
$this->assertEquals(
58-
Polygon::class,
59-
Geometry::getWKTClass('POLYGON((0 0,4 0,4 4,0 4,0 0),(1 1, 2 1, 2 2, 1 2,1 1))')
60-
);
61-
$this->assertEquals(
62-
MultiPoint::class,
63-
Geometry::getWKTClass('MULTIPOINT((0 0),(1 2))')
64-
);
65-
$this->assertEquals(
66-
MultiLineString::class,
67-
Geometry::getWKTClass('MULTILINESTRING((0 0,1 1,1 2),(2 3,3 2,5 4))')
68-
);
69-
$this->assertEquals(
70-
MultiPolygon::class,
71-
Geometry::getWKTClass('MULTIPOLYGON(((0 0,4 0,4 4,0 4,0 0),(1 1,2 1,2 2,1 2,1 1)), ((-1 -1,-1 -2,-2 -2,-2 -1,-1 -1)))')
72-
);
73-
$this->assertEquals(
74-
GeometryCollection::class,
75-
Geometry::getWKTClass('GEOMETRYCOLLECTION(POINT(2 3),LINESTRING(2 3,3 4))')
76-
);
28+
$this->assertEquals(Point::class, Geometry::getWKTClass('POINT(0 0)'));
29+
$this->assertEquals(LineString::class, Geometry::getWKTClass('LINESTRING(0 0,1 1,1 2)'));
30+
$this->assertEquals(Polygon::class, Geometry::getWKTClass('POLYGON((0 0,4 0,4 4,0 4,0 0),(1 1, 2 1, 2 2, 1 2,1 1))'));
31+
$this->assertEquals(MultiPoint::class, Geometry::getWKTClass('MULTIPOINT((0 0),(1 2))'));
32+
$this->assertEquals(MultiLineString::class, Geometry::getWKTClass('MULTILINESTRING((0 0,1 1,1 2),(2 3,3 2,5 4))'));
33+
$this->assertEquals(MultiPolygon::class, Geometry::getWKTClass('MULTIPOLYGON(((0 0,4 0,4 4,0 4,0 0),(1 1,2 1,2 2,1 2,1 1)), ((-1 -1,-1 -2,-2 -2,-2 -1,-1 -1)))'));
34+
$this->assertEquals(GeometryCollection::class, Geometry::getWKTClass('GEOMETRYCOLLECTION(POINT(2 3),LINESTRING(2 3,3 4))'));
7735
$this->assertException(UnknownWKTTypeException::class);
7836
Geometry::getWKTClass('TRIANGLE((0 0, 0 9, 9 0, 0 0))');
7937
}
8038

8139
public function testGetWKBClass()
8240
{
83-
$this->assertInstanceOf(
84-
Point::class,
85-
Geometry::fromWKB('0101000000000000000000f03f0000000000000040')
86-
);
41+
$this->assertInstanceOf(Point::class, Geometry::fromWKB('0101000000000000000000f03f0000000000000040'));
8742

88-
$this->assertInstanceOf(
89-
LineString::class,
90-
Geometry::fromWKB('010200000002000000000000000000f03f000000000000004000000000000008400000000000001040')
91-
);
92-
$this->assertInstanceOf(
93-
Polygon::class,
94-
Geometry::fromWKB('01030000000100000004000000000000000000f03f00000000000000400000000000000840000000000000104000000000000014400000000000001840000000000000f03f0000000000000040')
95-
);
96-
$this->assertInstanceOf(
97-
MultiPoint::class,
98-
Geometry::fromWKB('0104000000020000000101000000000000000000f03f0000000000000040010100000000000000000008400000000000001040')
99-
);
100-
$this->assertInstanceOf(
101-
MultiLineString::class,
102-
Geometry::fromWKB('010500000001000000010200000002000000000000000000f03f000000000000004000000000000008400000000000001040')
103-
);
104-
$this->assertInstanceOf(
105-
MultiLineString::class,
106-
Geometry::fromWKB('010500000002000000010200000002000000000000000000f03f000000000000004000000000000008400000000000001040010200000002000000000000000000144000000000000018400000000000001c400000000000002040')
107-
);
108-
$this->assertInstanceOf(
109-
MultiPolygon::class,
110-
Geometry::fromWKB('01060000000200000001030000000100000004000000000000000000f03f00000000000000400000000000000840000000000000104000000000000014400000000000001840000000000000f03f000000000000004001030000000300000004000000000000000000f03f00000000000000400000000000000840000000000000104000000000000014400000000000001840000000000000f03f000000000000004004000000000000000000264000000000000028400000000000002a400000000000002c400000000000002e4000000000000030400000000000002640000000000000284004000000000000000000354000000000000036400000000000003740000000000000384000000000000039400000000000003a4000000000000035400000000000003640')
111-
);
112-
$this->assertInstanceOf(
113-
GeometryCollection::class,
114-
Geometry::fromWKB('0107000000010000000101000000000000000000f03f0000000000000040')
115-
);
116-
$this->assertInstanceOf(
117-
GeometryCollection::class,
118-
Geometry::fromWKB('0107000000020000000101000000000000000000f03f0000000000000040010200000002000000000000000000f03f000000000000004000000000000008400000000000001040')
119-
);
43+
$this->assertInstanceOf(LineString::class, Geometry::fromWKB('010200000002000000000000000000f03f000000000000004000000000000008400000000000001040'));
44+
$this->assertInstanceOf(Polygon::class, Geometry::fromWKB('01030000000100000004000000000000000000f03f00000000000000400000000000000840000000000000104000000000000014400000000000001840000000000000f03f0000000000000040'));
45+
$this->assertInstanceOf(MultiPoint::class, Geometry::fromWKB('0104000000020000000101000000000000000000f03f0000000000000040010100000000000000000008400000000000001040'));
46+
$this->assertInstanceOf(MultiLineString::class, Geometry::fromWKB('010500000001000000010200000002000000000000000000f03f000000000000004000000000000008400000000000001040'));
47+
$this->assertInstanceOf(MultiLineString::class, Geometry::fromWKB('010500000002000000010200000002000000000000000000f03f000000000000004000000000000008400000000000001040010200000002000000000000000000144000000000000018400000000000001c400000000000002040'));
48+
$this->assertInstanceOf(MultiPolygon::class, Geometry::fromWKB('01060000000200000001030000000100000004000000000000000000f03f00000000000000400000000000000840000000000000104000000000000014400000000000001840000000000000f03f000000000000004001030000000300000004000000000000000000f03f00000000000000400000000000000840000000000000104000000000000014400000000000001840000000000000f03f000000000000004004000000000000000000264000000000000028400000000000002a400000000000002c400000000000002e4000000000000030400000000000002640000000000000284004000000000000000000354000000000000036400000000000003740000000000000384000000000000039400000000000003a4000000000000035400000000000003640'));
49+
$this->assertInstanceOf(GeometryCollection::class, Geometry::fromWKB('0107000000010000000101000000000000000000f03f0000000000000040'));
50+
$this->assertInstanceOf(GeometryCollection::class, Geometry::fromWKB('0107000000020000000101000000000000000000f03f0000000000000040010200000002000000000000000000f03f000000000000004000000000000008400000000000001040'));
12051

12152
$prefix = "\0\0\0\0";
122-
$this->assertInstanceOf(
123-
Point::class,
124-
Geometry::fromWKB($prefix . '0101000000000000000000f03f0000000000000040')
125-
);
126-
53+
$this->assertInstanceOf(Point::class, Geometry::fromWKB($prefix.'0101000000000000000000f03f0000000000000040'));
12754
}
12855
}

tests/Unit/Types/MultiLineStringTest.php

Lines changed: 8 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -16,15 +16,13 @@ public function testFromWKT()
1616

1717
public function testToWKT()
1818
{
19-
$collection = new LineString(
20-
[
19+
$collection = new LineString([
2120
new Point(0, 0),
2221
new Point(0, 1),
2322
new Point(1, 1),
2423
new Point(1, 0),
2524
new Point(0, 0),
26-
]
27-
);
25+
]);
2826

2927
$multilinestring = new MultiLineString([$collection]);
3028

@@ -36,22 +34,21 @@ public function testJsonSerialize()
3634
$multilinestring = MultiLineString::fromWKT('MULTILINESTRING((0 0,1 1,1 2),(2 3,3 2,5 4))');
3735

3836
$this->assertInstanceOf(\GeoJson\Geometry\MultiLineString::class, $multilinestring->jsonSerialize());
39-
$this->assertSame(
40-
'{"type":"MultiLineString","coordinates":[[[0,0],[1,1],[1,2]],[[2,3],[3,2],[5,4]]]}',
41-
json_encode($multilinestring)
42-
);
37+
$this->assertSame('{"type":"MultiLineString","coordinates":[[[0,0],[1,1],[1,2]],[[2,3],[3,2],[5,4]]]}', json_encode($multilinestring));
4338
}
4439

45-
public function testInvalidArgumentExceptionAtLeastOneEntry() {
40+
public function testInvalidArgumentExceptionAtLeastOneEntry()
41+
{
4642
$this->assertException(InvalidArgumentException::class);
4743
$multilinestring = new MultiLineString([]);
4844
}
4945

50-
public function testInvalidArgumentExceptionNotArrayOfLineString() {
46+
public function testInvalidArgumentExceptionNotArrayOfLineString()
47+
{
5148
$this->assertException(InvalidArgumentException::class);
5249
$multilinestring = new MultiLineString([
5350
new LineString([new Point(0, 0), new Point(1, 1)]),
54-
new Point(0,1)
51+
new Point(0, 1),
5552
]);
5653
}
5754
}

tests/Unit/Types/MultiPointTest.php

Lines changed: 17 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -36,15 +36,17 @@ public function testToArray()
3636
$this->assertInstanceOf(Point::class, $multipoint->toArray()[0]);
3737
}
3838

39-
public function testIteratorAggregate() {
39+
public function testIteratorAggregate()
40+
{
4041
$multipoint = MultiPoint::fromWKT('MULTIPOINT((0 0),(1 0),(1 1))');
4142

42-
foreach($multipoint as $value) {
43+
foreach ($multipoint as $value) {
4344
$this->assertInstanceOf(Point::class, $value);
4445
}
4546
}
4647

47-
public function testArrayAccess() {
48+
public function testArrayAccess()
49+
{
4850
$point0 = new Point(0, 0);
4951
$point1 = new Point(1, 1);
5052
$multipoint = new MultiPoint([$point0, $point1]);
@@ -67,10 +69,10 @@ public function testArrayAccess() {
6769

6870
$this->assertException(InvalidArgumentException::class);
6971
$multipoint[] = 1;
70-
7172
}
7273

73-
public function testPrependPoint() {
74+
public function testPrependPoint()
75+
{
7476
$point1 = new Point(1, 1);
7577
$point2 = new Point(2, 2);
7678
$multipoint = new MultiPoint([$point1, $point2]);
@@ -83,7 +85,8 @@ public function testPrependPoint() {
8385
$this->assertEquals($point2, $multipoint->getPoints()[2]);
8486
}
8587

86-
public function testAppendPoint() {
88+
public function testAppendPoint()
89+
{
8790
$point0 = new Point(0, 0);
8891
$point1 = new Point(1, 1);
8992
$multipoint = new MultiPoint([$point0, $point1]);
@@ -96,7 +99,8 @@ public function testAppendPoint() {
9699
$this->assertEquals($point2, $multipoint->getPoints()[2]);
97100
}
98101

99-
public function testInsertPoint() {
102+
public function testInsertPoint()
103+
{
100104
$point1 = new Point(1, 1);
101105
$point3 = new Point(3, 3);
102106
$multipoint = new MultiPoint([$point1, $point3]);
@@ -109,7 +113,7 @@ public function testInsertPoint() {
109113
$this->assertEquals($point3, $multipoint->getPoints()[2]);
110114

111115
$this->assertException(InvalidArgumentException::class);
112-
$multipoint->insertPoint(100, new Point(100,100));
116+
$multipoint->insertPoint(100, new Point(100, 100));
113117
}
114118

115119
public function testJsonSerialize()
@@ -122,16 +126,18 @@ public function testJsonSerialize()
122126
$this->assertSame('{"type":"MultiPoint","coordinates":[[0,0],[1,0],[1,1]]}', json_encode($multipoint));
123127
}
124128

125-
public function testInvalidArgumentExceptionAtLeastOneEntry() {
129+
public function testInvalidArgumentExceptionAtLeastOneEntry()
130+
{
126131
$this->assertException(InvalidArgumentException::class);
127132
$multipoint = new MultiPoint([]);
128133
}
129134

130-
public function testInvalidArgumentExceptionNotArrayOfLineString() {
135+
public function testInvalidArgumentExceptionNotArrayOfLineString()
136+
{
131137
$this->assertException(InvalidArgumentException::class);
132138
$multipoint = new MultiPoint([
133139
new Point(0, 0),
134-
1
140+
1,
135141
]);
136142
}
137143
}

0 commit comments

Comments
 (0)