cdnManager = new CdnManager($testAuth); global $timestampAntiLeechEncryptKey; $this->encryptKey = $timestampAntiLeechEncryptKey; global $testStartDate; $this->testStartDate = $testStartDate; global $testEndDate; $this->testEndDate = $testEndDate; global $testGranularity; $this->testGranularity = $testGranularity; global $testLogDate; $this->testLogDate = $testLogDate; global $customDomain; $this->refreshUrl = $customDomain . '/sdktest.png'; $this->refreshDirs = $customDomain; $this->customDomain = $customDomain; global $customDomain2; $this->customDomain2 = $customDomain2; } public function testRefreshUrls() { list($ret, $err) = $this->cdnManager->refreshUrls(array($this->refreshUrl)); $this->assertNull($err); $this->assertNotNull($ret); } public function testRefreshDirs() { list($ret, $err) = $this->cdnManager->refreshDirs(array($this->refreshDirs)); $this->assertNull($err); $this->assertNotNull($ret); } public function testRefreshUrlsAndDirs() { list($ret, $err) = $this->cdnManager->refreshUrlsAndDirs(array($this->refreshUrl), array($this->refreshDirs)); $this->assertNull($err); $this->assertNotNull($ret); } public function testGetCdnRefreshList() { list($ret, $err) = $this->cdnManager->getCdnRefreshList(null, null, null, 'success'); $this->assertNull($err); $this->assertNotNull($ret); } public function testPrefetchUrls() { list($ret, $err) = $this->cdnManager->prefetchUrls(array($this->refreshUrl)); $this->assertNull($err); $this->assertNotNull($ret); } public function testGetCdnPrefetchList() { list($ret, $err) = $this->cdnManager->getCdnPrefetchList(null, null, 'success'); $this->assertNull($err); $this->assertNotNull($ret); } public function testGetBandwidthData() { list($ret, $err) = $this->cdnManager->getBandwidthData( array($this->customDomain2), $this->testStartDate, $this->testEndDate, $this->testGranularity ); $this->assertNull($err); $this->assertNotNull($ret); } public function testGetFluxData() { list($ret, $err) = $this->cdnManager->getFluxData( array($this->customDomain2), $this->testStartDate, $this->testEndDate, $this->testGranularity ); $this->assertNull($err); $this->assertNotNull($ret); } public function testGetCdnLogList() { list($ret, $err) = $this->cdnManager->getCdnLogList(array('fake.qiniu.com'), $this->testLogDate); $this->assertNotNull($err); $this->assertNull($ret); } public function testCreateTimestampAntiLeechUrl() { $signUrl = $this->cdnManager->createTimestampAntiLeechUrl($this->refreshUrl, $this->encryptKey, 3600); $response = Client::get($signUrl); $this->assertNull($response->error); $this->assertEquals($response->statusCode, 200); $signUrl = $this->cdnManager->createTimestampAntiLeechUrl( $this->refreshUrl . '?qiniu', $this->encryptKey, 3600 ); $response = Client::get($signUrl); $this->assertNull($response->error); $this->assertEquals($response->statusCode, 200); } }