public function GmapPolylineToolboxTestCase::testGmapPolylineToolbox in GMap Module 7.2
File
- tests/
oopmigration.test, line 26 - unit tests for refactoring steps
Class
Code
public function testGmapPolylineToolbox() {
include_once drupal_get_path('module', 'gmap') . '/tests/inc/gmap_polyutil.inc';
include_once drupal_get_path('module', 'gmap') . '/lib/Drupal/gmap/GmapPolylineToolbox.php';
// legacy_gmap_polyutil_encode_latlon($x)
$check = \tests\inc\legacy_gmap_polyutil_encode_latlon(34);
$result = GmapPolylineToolbox::getInstance()
->setLatLonNumber(34)
->getEncodedLatLon();
$this
->assertEqual($check, $result);
// legacy_gmap_polyutil_encode_latlon($x)
$check = \tests\inc\legacy_gmap_polyutil_encode_latlon(-34);
$result = GmapPolylineToolbox::getInstance()
->setLatLonNumber(-34)
->getEncodedLatLon();
$this
->assertEqual($check, $result);
// legacy_gmap_polyutil_encode_levels($x)
$check = \tests\inc\legacy_gmap_polyutil_encode_levels(-34);
$result = GmapPolylineToolbox::getInstance()
->setLatLonNumber(-34)
->getEncodedLevels();
$this
->assertEqual($check, $result);
// legacy__gmap_polyutil_encode($x)
$check = \tests\inc\legacy__gmap_polyutil_encode(500);
$result = GmapPolylineToolbox::getInstance()
->setLatLonNumber(500)
->getEncode();
$this
->assertEqual($check, $result);
$check = \tests\inc\legacy__gmap_polyutil_encode(-500);
$result = GmapPolylineToolbox::getInstance()
->setLatLonNumber(-500)
->getEncode();
$this
->assertEqual($check, $result);
// legacy_gmap_polyutil_dist($p1, $p2)
$check = \tests\inc\legacy_gmap_polyutil_dist(array(
23,
45,
), array(
123,
145,
));
$result = GmapPolylineToolbox::getInstance()
->setLinePoints(array(
23,
45,
), array(
123,
145,
))
->getDist();
$this
->assertEqual($check, $result);
// legacy_gmap_polyutil_point_line_dist($q, $p1, $p2)
$check = \tests\inc\legacy_gmap_polyutil_point_line_dist(array(
1,
10,
), array(
23,
45,
), array(
123,
145,
));
$result = GmapPolylineToolbox::getInstance()
->setMeasurePoint(array(
1,
10,
))
->setLinePoints(array(
23,
45,
), array(
123,
145,
))
->getPointLineDist();
$this
->assertEqual($check, $result);
$check = \tests\inc\legacy_gmap_polyutil_point_line_dist(array(
1,
10,
), array(
23,
45,
), array(
23,
45,
));
$result = GmapPolylineToolbox::getInstance()
->setMeasurePoint(array(
1,
10,
))
->setLinePoints(array(
23,
45,
), array(
23,
45,
))
->getPointLineDist();
$this
->assertEqual($check, $result);
// legacy_gmap_polyutil_dp_encode($points)
$check = \tests\inc\legacy_gmap_polyutil_dp_encode(array(
array(
23,
45,
),
array(
123,
145,
),
));
$result = GmapPolylineToolbox::getInstance()
->setPoints(array(
array(
23,
45,
),
array(
123,
145,
),
))
->getDPEncode();
$this
->assertEqual($check, $result);
$check = \tests\inc\legacy_gmap_polyutil_dp_encode(array(
array(
23,
45,
),
array(
123,
145,
),
array(
1,
10,
),
));
$result = GmapPolylineToolbox::getInstance()
->setPoints(array(
array(
23,
45,
),
array(
123,
145,
),
array(
1,
10,
),
))
->getDPEncode();
$this
->assertEqual($check, $result);
// legacy_gmap_polyutil_polyline($points)
$check = \tests\inc\legacy_gmap_polyutil_polyline(array(
array(
23,
45,
),
array(
123,
145,
),
));
$result = GmapPolylineToolbox::getInstance()
->setPoints(array(
array(
23,
45,
),
array(
123,
145,
),
))
->getPolyline();
$this
->assertEqual($check, $result);
$check = \tests\inc\legacy_gmap_polyutil_polyline(array(
array(
23,
45,
),
array(
123,
145,
),
array(
1,
10,
),
));
$result = GmapPolylineToolbox::getInstance()
->setPoints(array(
array(
23,
45,
),
array(
123,
145,
),
array(
1,
10,
),
))
->getPolyline();
$this
->assertEqual($check, $result);
// legacy__gmap_polyutil_zoom_levels()
$check = \tests\inc\legacy__gmap_polyutil_zoom_levels();
$result = GmapPolylineToolbox::getInstance()
->getZoomLevels();
$this
->assertEqual($check, $result);
// legacy__gmap_polyutil_get_zoom_level($weight)
$check = \tests\inc\legacy__gmap_polyutil_get_zoom_level(12);
$result = GmapPolylineToolbox::getInstance()
->setWeight(12)
->getZoomLevel();
$this
->assertEqual($check, $result);
}