@@ -21,15 +21,15 @@ public function testWithMinimalConfiguration(): void
21
21
{
22
22
$ leafletOptions = new LeafletOptions ();
23
23
24
- $ array = $ leafletOptions ->toArray ();
25
-
26
24
self ::assertSame ([
27
25
'tileLayer ' => [
28
26
'url ' => 'https://tile.openstreetmap.org/{z}/{x}/{y}.png ' ,
29
27
'attribution ' => '© <a href="https://www.openstreetmap.org/copyright">OpenStreetMap</a> ' ,
30
- 'options ' => $ array [ ' tileLayer ' ][ ' options ' ], // stdClass
28
+ 'options ' => [],
31
29
],
32
- ], $ array );
30
+ ], $ leafletOptions ->toArray ());
31
+
32
+ self ::assertEquals ($ leafletOptions , LeafletOptions::fromArray ($ leafletOptions ->toArray ()));
33
33
}
34
34
35
35
public function testWithMaximumConfiguration (): void
@@ -47,18 +47,19 @@ public function testWithMaximumConfiguration(): void
47
47
),
48
48
);
49
49
50
- $ array = $ leafletOptions ->toArray ();
51
-
52
50
self ::assertSame ([
53
51
'tileLayer ' => [
54
52
'url ' => 'https://tile.openstreetmap.org/{z}/{x}/{y}.png ' ,
55
53
'attribution ' => '© <a href="https://www.openstreetmap.org/copyright">OpenStreetMap</a> ' ,
56
- 'options ' => $ array ['tileLayer ' ]['options ' ], // stdClass
54
+ 'options ' => [
55
+ 'maxZoom ' => 19 ,
56
+ 'minZoom ' => 1 ,
57
+ 'maxNativeZoom ' => 18 ,
58
+ 'zoomOffset ' => 0 ,
59
+ ],
57
60
],
58
- ], $ array );
59
- self ::assertSame (19 , $ array ['tileLayer ' ]['options ' ]->maxZoom );
60
- self ::assertSame (1 , $ array ['tileLayer ' ]['options ' ]->minZoom );
61
- self ::assertSame (18 , $ array ['tileLayer ' ]['options ' ]->maxNativeZoom );
62
- self ::assertSame (0 , $ array ['tileLayer ' ]['options ' ]->zoomOffset );
61
+ ], $ leafletOptions ->toArray ());
62
+
63
+ self ::assertEquals ($ leafletOptions , LeafletOptions::fromArray ($ leafletOptions ->toArray ()));
63
64
}
64
65
}
0 commit comments