/** * Tests Countable and Traversable interfaces. */ public function testInterfaces() { $point = Point::fromText('POINT (1 2)'); $lineString = LineString::fromText('LINESTRING (1 2, 3 4)'); $geometryCollection = GeometryCollection::of($point, $lineString); $this->assertInstanceOf(\Countable::class, $geometryCollection); $this->assertSame(2, count($geometryCollection)); $this->assertInstanceOf(\Traversable::class, $geometryCollection); $this->assertSame([$point, $lineString], iterator_to_array($geometryCollection)); }
/** * @dataProvider providerWriteEmptyGeometryCollection * * @param string $wkt The WKT to test. */ public function testWriteEmptyGeometryCollection($wkt) { $writer = new WKTWriter(); $geometry = GeometryCollection::fromText($wkt); $this->assertSame($wkt, $writer->write($geometry)); }