PHP Classes

File: GeoCoordinateTest.php

Recommend this page to a friend!
  Packages of Pavel Astakhov   Geographic Coordinates Conversion   GeoCoordinateTest.php   Download  
File: GeoCoordinateTest.php
Role: Unit test script
Content type: text/plain
Description: PHP unit test for GeoCoordinate class
Class: Geographic Coordinates Conversion
Convert location coordinates into decimal values
Author: By
Last change:
Date: 13 years ago
Size: 7,343 bytes
 

 

Contents

Class file image Download
<?php

/**
 * Generated by PHPUnit_SkeletonGenerator 1.2.0 on 2013-01-27 at 15:10:05.
 */
class GeoCoordinateTest extends \PHPUnit_Framework_TestCase {

    /**
     * @var GeoCoordinate
     */
    protected $object;

    /**
     * Sets up the fixture, for example, opens a network connection.
     * This method is called before a test is executed.
     */
    protected function setUp() {
        $this->object = new GeoCoordinate;
    }

    /**
     * Tears down the fixture, for example, closes a network connection.
     * This method is called after a test is executed.
     */
    protected function tearDown() {

    }

    /**
     * Generated from @assert ("55.755831°, 37.617673°") == array("lat" => 55.755831, "lon"=> 37.617673).
     *
     * @covers GeoCoordinate::getLatLonFromString
     */
    public function testGetLatLonFromString() {
        $this->assertEquals(
                array("lat" => 55.755831, "lon" => 37.617673), GeoCoordinate::getLatLonFromString("55.755831°, 37.617673°")
        );
    }

    /**
     * Generated from @assert ("N55.755831°, E37.617673°") == array("lat" => 55.755831, "lon"=> 37.617673).
     *
     * @covers GeoCoordinate::getLatLonFromString
     */
    public function testGetLatLonFromString2() {
        $this->assertEquals(
                array("lat" => 55.755831, "lon" => 37.617673), GeoCoordinate::getLatLonFromString("N55.755831°, E37.617673°")
        );
    }

    /**
     * Generated from @assert ("55°45.34986'N, 37°37.06038'E") == array("lat" => 55.755831, "lon"=> 37.617673).
     *
     * @covers GeoCoordinate::getLatLonFromString
     */
    public function testGetLatLonFromString3() {
        $this->assertEquals(
                array("lat" => 55.755831, "lon" => 37.617673), GeoCoordinate::getLatLonFromString("55°45.34986'N, 37°37.06038'E")
        );
    }

    /**
     * Generated from @assert ("55°45'20.9916\"N, 37°37'3.6228\"E") == array("lat" => 55.755831, "lon"=> 37.617673).
     *
     * @covers GeoCoordinate::getLatLonFromString
     */
    public function testGetLatLonFromString4() {
        $this->assertEquals(
                array("lat" => 55.755831, "lon" => 37.617673), GeoCoordinate::getLatLonFromString("55°45'20.9916\"N, 37°37'3.6228\"E")
        );
    }

    /**
     * Generated from @assert (" 37°37'3.6228\"E, 55°45'20.9916\" ") == array("lat" => 55.755831, "lon"=> 37.617673).
     *
     * @covers GeoCoordinate::getLatLonFromString
     */
    public function testGetLatLonFromString5() {
        $this->assertEquals(
                array("lat" => 55.755831, "lon" => 37.617673), GeoCoordinate::getLatLonFromString(" 37°37'3.6228\"E, 55°45'20.9916\" ")
        );
    }

    /**
     * Generated from @assert (" 37°37'3.6228\", 55°45'20.9916\" N ") == array("lat" => 55.755831, "lon"=> 37.617673).
     *
     * @covers GeoCoordinate::getLatLonFromString
     */
    public function testGetLatLonFromString6() {
        $this->assertEquals(
                array("lat" => 55.755831, "lon" => 37.617673), GeoCoordinate::getLatLonFromString(" 37°37'3.6228\", 55°45'20.9916\" N ")
        );
    }

    /**
     * Generated from @assert ("55°45'20.9916\"N, 37°37'3.6228\"") == array("lat" => 55.755831, "lon"=> 37.617673).
     *
     * @covers GeoCoordinate::getLatLonFromString
     */
    public function testGetLatLonFromString7() {
        $this->assertEquals(
                array("lat" => 55.755831, "lon" => 37.617673), GeoCoordinate::getLatLonFromString("55°45'20.9916\"N, 37°37'3.6228\"")
        );
    }

    /**
     * Generated from @assert ("55°45'20.9916\", E37°37'3.6228\"") == array("lat" => 55.755831, "lon"=> 37.617673).
     *
     * @covers GeoCoordinate::getLatLonFromString
     */
    public function testGetLatLonFromString8() {
        $this->assertEquals(
                array("lat" => 55.755831, "lon" => 37.617673), GeoCoordinate::getLatLonFromString("55°45'20.9916\", E37°37'3.6228\"")
        );
    }

    /**
     * Generated from @assert (" 10  , - 10 ") == array("lat" => 10, "lon"=> -10).
     *
     * @covers GeoCoordinate::getLatLonFromString
     */
    public function testGetLatLonFromString9() {
        $this->assertEquals(
                array("lat" => 10, "lon" => -10), GeoCoordinate::getLatLonFromString(" 10  , - 10 ")
        );
    }

    /**
     * Generated from @assert ("-10°,s10 °  ") == array("lat" => -10, "lon"=> -10).
     *
     * @covers GeoCoordinate::getLatLonFromString
     */
    public function testGetLatLonFromString10() {
        $this->assertEquals(
                array("lat" => -10, "lon" => -10), GeoCoordinate::getLatLonFromString("-10°,s10 °  ")
        );
    }

    /**
     * Generated from @assert ("s10.123456°,  -1.123°   ") == array("lat" => -10.123456, "lon"=> -1.123).
     *
     * @covers GeoCoordinate::getLatLonFromString
     */
    public function testGetLatLonFromString11() {
        $this->assertEquals(
                array("lat" => -10.123456, "lon" => -1.123), GeoCoordinate::getLatLonFromString("s10.123456°,  -1.123°   ")
        );
    }

    /**
     * Generated from @assert ("10.123456° N,  1.123° W  ") == array("lat" => 10.123456, "lon"=> -1.123).
     *
     * @covers GeoCoordinate::getLatLonFromString
     */
    public function testGetLatLonFromString12() {
        $this->assertEquals(
                array("lat" => 10.123456, "lon" => -1.123), GeoCoordinate::getLatLonFromString("10.123456° N,  1.123° W  ")
        );
    }

    /**
     * Generated from @assert ("10.12° W,  1.123° s  ") == array("lat" => -1.123, "lon"=> -10.12).
     *
     * @covers GeoCoordinate::getLatLonFromString
     */
    public function testGetLatLonFromString13() {
        $this->assertEquals(
                array("lat" => -1.123, "lon" => -10.12), GeoCoordinate::getLatLonFromString("10.12° W,  1.123° s  ")
        );
    }

    /**
     * Generated from @assert ("10.12° w,  1.123°") == array("lat" => 1.123, "lon"=> -10.12).
     *
     * @covers GeoCoordinate::getLatLonFromString
     */
    public function testGetLatLonFromString14() {
        $this->assertEquals(
                array("lat" => 1.123, "lon" => -10.12), GeoCoordinate::getLatLonFromString("10.12° w,  1.123°")
        );
    }

    /**
     * Generated from @assert ("Z10.12°,  1.123°") === false.
     *
     * @covers GeoCoordinate::getLatLonFromString
     */
    public function testGetLatLonFromString15() {
        $this->assertSame(
                false, GeoCoordinate::getLatLonFromString("Z10.12°,  1.123°")
        );
    }

    /**
     * Generated from @assert ("10.12°, X1.123°") === false.
     *
     * @covers GeoCoordinate::getLatLonFromString
     */
    public function testGetLatLonFromString16() {
        $this->assertSame(
                false, GeoCoordinate::getLatLonFromString("10.12°, X1.123°")
        );
    }

    /**
     * Generated from @assert ("Tralala") === false.
     *
     * @covers GeoCoordinate::getLatLonFromString
     */
    public function testGetLatLonFromString17() {
        $this->assertSame(
                false, GeoCoordinate::getLatLonFromString("Tralala")
        );
    }

}