/** * @test */ public function lookUpForAFullGermanAddressSetsCoordinatesOfAddress() { $geo = new Tx_Oelib_Tests_Unit_Fixtures_TestingGeo(); $geo->setGeoAddress('Am Hof 1, 53113 Zentrum, Bonn, DE'); $this->subject->lookUp($geo); $coordinates = $geo->getGeoCoordinates(); self::assertEquals(50.73355, $coordinates['latitude'], '', 0.1); self::assertEquals(7.10143, $coordinates['longitude'], '', 0.1); }
/** * Cleans up oelib after running a test. * * @return void */ public function cleanUp() { Tx_Oelib_ConfigurationProxy::purgeInstances(); Tx_Oelib_BackEndLoginManager::purgeInstance(); Tx_Oelib_ConfigurationRegistry::purgeInstance(); Tx_Oelib_FrontEndLoginManager::purgeInstance(); tx_oelib_Geocoding_Google::purgeInstance(); tx_oelib_headerProxyFactory::purgeInstance(); Tx_Oelib_MapperRegistry::purgeInstance(); Tx_Oelib_PageFinder::purgeInstance(); Tx_Oelib_Session::purgeInstances(); Tx_Oelib_TemplateHelper::purgeCachedConfigurations(); Tx_Oelib_TranslatorRegistry::purgeInstance(); /** @var Tx_Oelib_MailerFactory $mailerFactory */ $mailerFactory = t3lib_div::makeInstance('Tx_Oelib_MailerFactory'); $mailerFactory->cleanUp(); }
/** * Makes sure the necessary amount of time has passed since the last * geocoding request. * * @return void */ protected function throttle() { if (self::$lastGeocodingTimestamp > 0.0) { $secondsSinceLastRequest = microtime(TRUE) - self::$lastGeocodingTimestamp; if ($secondsSinceLastRequest < self::GEOCODING_THROTTLING) { usleep(1000000 * (self::GEOCODING_THROTTLING - $secondsSinceLastRequest)); } } self::$lastGeocodingTimestamp = microtime(TRUE); }