Ejemplo n.º 1
0
 private function assertCdnResponse(CDN $cdn, $expectedId)
 {
     $this->assertTrue($cdn instanceof CDN);
     $this->assertEquals("cdn.cdnhub.com", $cdn->getUrl());
     $this->assertEquals(2880, $cdn->getCacheExpiration());
     $this->assertEquals($expectedId, $cdn->getId());
 }
Ejemplo n.º 2
0
 /**
  * @expectedException \InvalidArgumentException
  */
 public function testCdnAlreadyRegistered()
 {
     $cdn77 = new Cdn77();
     $cdn = new CDN();
     $cdn->setNameSlug("test_cdn");
     $cdn77->addCdn($cdn);
     $cdn77->addCdn($cdn);
 }
Ejemplo n.º 3
0
 private function createCdnFromData($cdnData)
 {
     $cdn = new CDN();
     $cdn->setUrl($cdnData['cname']);
     $cdn->setId($cdnData['id']);
     $cdn->setCacheExpiration($cdnData['cache_expiry']);
     return $cdn;
 }
Ejemplo n.º 4
0
 public function testCorrectQueryStringSingleCdn()
 {
     $method = new CdnTest();
     $cdn = new CDN();
     $cdn->setId(1);
     $method->setCdn($cdn);
     $actual = $method->getQueryString();
     $expected = "?id=1";
     $this->assertEquals($expected, $actual);
 }
Ejemplo n.º 5
0
 public function testCorrectQueryString()
 {
     $cdn = new CDN();
     $cdn->setId(1);
     $method = new PurgeAll();
     $method->setCdn($cdn);
     $method->setLogin('test');
     $method->setPassword('password');
     $actual = $method->getQueryString();
     $expected = "?id=1&login=test&password=password";
     $this->assertEquals($expected, $actual);
 }
Ejemplo n.º 6
0
 public function testCorrectQueryStringMultipleFiles()
 {
     $cdn = new CDN();
     $cdn->setId(1);
     $method = new Purge();
     $method->setCdn($cdn);
     $method->setLogin('test');
     $method->setPassword('password');
     $method->addFile("/test/file/");
     $method->addFile("/test/file2/new.jpg.mov");
     $actual = $method->getQueryString();
     $expected = "?id=1&login=test&password=password&json=%7B%22purge_paths%22%3A%5B%5B%22%5C%2Ftest%5C%2Ffile%5C%2F%22%2C%22%5C%2Ftest%5C%2Ffile2%5C%2Fnew.jpg.mov%22%5D%5D%7D";
     $this->assertEquals($expected, $actual);
 }
Ejemplo n.º 7
0
 /**
  * @param \AFM\Cdn77\CDN $cdn
  */
 public function setCdn(CDN $cdn)
 {
     $this->cdn = $cdn;
     $this->params['id'] = $cdn->getId();
 }