コード例 #1
0
 /**
  * Test that redundant checks work.
  *
  * @group Plugins
  */
 public function testGeoIpUpdaterRedundantChecks()
 {
     GeoIp::$geoIPDatabaseDir = 'tests/lib/geoip-files';
     LocationProvider::$providers = null;
     // create empty ISP & Org files
     $this->createEmptyISPOrgFiles();
     // run redundant checks
     $updater = new Piwik_UserCountry_GeoIPAutoUpdater_publictest();
     $updater->performRedundantDbChecks();
     // check that files are renamed correctly
     $this->checkBrokenGeoIPState();
     // create empty files again & run checks again
     $this->createEmptyISPOrgFiles();
     $updater->performRedundantDbChecks();
     // check that w/ broken files already there, redundant checks still work correctly
     $this->checkBrokenGeoIPState();
 }
コード例 #2
0
 private function setMockLocationProvider()
 {
     LocationProvider::$providers = null;
     LocationProvider::setCurrentProvider('mock_provider');
     \MockLocationProvider::$locations = array(self::makeLocation('Stratford-upon-Avon', 'P3', 'gb', 123.456, 21.321), self::makeLocation('Nuneaton and Bedworth', 'P3', 'gb', $isp = 'comcast.net'), self::makeLocation('Stratford-upon-Avon', 'P3', 'gb', 124.456, 22.231, $isp = 'comcast.net'), self::makeLocation('London', 'H9', 'gb'), self::makeLocation('Stratford-upon-Avon', 'G5', 'gb', $lat = null, $long = null, $isp = 'awesomeisp.com'), self::makeLocation('Stratford-upon-Avon', '66', 'ru'), self::makeLocation('Hluboká nad Vltavou', '66', 'ru'), self::makeLocation('Stratford-upon-Avon', '66', 'mk'), self::makeLocation(null, null, null));
 }
コード例 #3
0
 public function tearDown()
 {
     LocationProvider::$providers = null;
     GeoIp::$geoIPDatabaseDir = 'tests/lib/geoip-files';
     ManyVisitsWithGeoIP::unsetLocationProvider();
 }