Location\PolygonTest::testIfGetSegmentsWorksAsExpected PHP 메소드

testIfGetSegmentsWorksAsExpected() 공개 메소드

    public function testIfGetSegmentsWorksAsExpected()
    {
        $polygon = new Polygon();
        $point1 = new Coordinate(10, 20);
        $point2 = new Coordinate(10, 40);
        $point3 = new Coordinate(30, 40);
        $point4 = new Coordinate(30, 20);
        $polygon->addPoint($point1);
        $polygon->addPoint($point2);
        $polygon->addPoint($point3);
        $polygon->addPoint($point4);
        $expected = [new Line($point1, $point2), new Line($point2, $point3), new Line($point3, $point4), new Line($point4, $point1)];
        $this->assertEquals($expected, $polygon->getSegments());
    }