Beispiel #1
0
 public function testUrlBuilderCycleShard()
 {
     // generate a url for the number of domains in use ensure they're cycled through...
     $domains = array("jackangers.imgix.net", "jackangers2.imgix.net", "jackangers3.imgix.net");
     $ub = new URLBuilder($domains, false, "", ShardStrategy::CRC, false);
     $ub->setShardStrategy(ShardStrategy::CYCLE);
     for ($i = 0; $i < 100; $i++) {
         $used = array();
         foreach ($domains as $domain) {
             $url = $ub->createURL("chester.png");
             $curDomain = parse_url($url)["host"];
             $this->assertFalse(in_array($curDomain, $used));
             $used[] = $curDomain;
         }
     }
 }