Example #1
0
 /**
  * @test
  */
 public function moveInRandomDirectionAndDistanceCalledTwiceCreatesDifferentCoordinates()
 {
     $maximumDistance = 100.0;
     $this->subject->moveInRandomDirectionAndDistance($this->geoObject, $maximumDistance);
     $firstCoordinates = $this->geoObject->getGeoCoordinates();
     $this->subject->moveInRandomDirectionAndDistance($this->geoObject, $maximumDistance);
     self::assertNotSame($firstCoordinates, $this->geoObject->getGeoCoordinates());
 }
Example #2
0
 /**
  * @test
  */
 public function lookUpAfterClearCoordinatesSetsNoCoordinates()
 {
     $this->subject->setCoordinates(42.0, 42.0);
     $this->subject->clearCoordinates();
     $geo = new Tx_Oelib_Tests_Unit_Fixtures_TestingGeo();
     $geo->setGeoAddress('Am Hof 1, 53113 Zentrum, Bonn, DE');
     $this->subject->lookUp($geo);
     self::assertFalse($geo->hasGeoCoordinates());
 }
Example #3
0
 /**
  * @test
  */
 public function lookUpThrottlesRequestsByAtLeast35Seconds()
 {
     self::markTestSkipped('This test usually is not executed because it takes more than 30 seconds to execute.');
     $jsonResult = '{ "results" : [ { "address_components" : [ { "long_name" : "1", "short_name" : "1", ' . '"types" : [ "street_number" ] }, { "long_name" : "Am Hof", "short_name" : "Am Hof", ' . '"types" : [ "route" ] }, { "long_name" : "Bonn", "short_name" : "Bonn", ' . '"types" : [ "sublocality", "political" ] }, { "long_name" : "Bonn", "short_name" : "Bonn", ' . '"types" : [ "locality", "political" ] }, { "long_name" : "Bonn", "short_name" : "BN", ' . '"types" : [ "administrative_area_level_2", "political" ] }, { "long_name" : "Nordrhein-Westfalen", ' . '"short_name" : "Nordrhein-Westfalen", "types" : [ "administrative_area_level_1", "political" ] }, ' . '{ "long_name" : "Germany", "short_name" : "DE", "types" : [ "country", "political" ] }, ' . '{ "long_name" : "53113", "short_name" : "53113", "types" : [ "postal_code" ] } ], ' . '"formatted_address" : "Am Hof 1, 53113 Bonn, Germany", "geometry" : { "location" : ' . '{ "lat" : 50.733550, "lng" : 7.101430 }, "location_type" : "ROOFTOP", ' . '"viewport" : { "northeast" : { "lat" : 50.73489898029150, "lng" : 7.102778980291502 }, ' . '"southwest" : { "lat" : 50.73220101970850, "lng" : 7.100081019708497 } } }, ' . '"types" : [ "street_address" ] } ], "status" : "OK"}';
     $geo1 = new Tx_Oelib_Tests_Unit_Fixtures_TestingGeo();
     $geo1->setGeoAddress('Am Hof 1, 53113 Zentrum, Bonn, DE');
     $geo2 = new Tx_Oelib_Tests_Unit_Fixtures_TestingGeo();
     $geo2->setGeoAddress('Am Hof 1, 53113 Zentrum, Bonn, DE');
     /** @var tx_oelib_Geocoding_Google|PHPUnit_Framework_MockObject_MockObject $subject */
     $subject = $this->getMock('tx_oelib_Geocoding_Google', array('sendRequest'), array(), '', FALSE);
     $subject->expects(self::any())->method('sendRequest')->will(self::returnValue($jsonResult));
     $startTime = microtime(TRUE);
     $subject->lookUp($geo1);
     $subject->lookUp($geo2);
     $endTime = microtime(TRUE);
     $timePassed = $endTime - $startTime;
     self::assertGreaterThan(35.0, $timePassed);
 }