示例#1
0
 /**
  * @depends test_canCreateDownloadUrl
  */
 public function test_canDeleteDownloadUrl()
 {
     // Find movie
     $obj = new Lists($this->getApiKey(), $this->getApiSecret());
     $obj->setSearch($this->getFileName());
     $response = $obj->send()->json();
     $this->validateResponse($response, 'Could not "Find movie" from: test_DeleteCreatedFile');
     $this->assertArrayHasKey('videos', $response);
     $this->assertCount(1, $response['videos']);
     $key = $response['videos'][0]['key'];
     // Delete movie
     $deleter = new Delete($this->getApiKey(), $this->getApiSecret());
     $deleter->setVideoKey($key);
     $response = $deleter->send()->json();
     $this->validateResponse($response, 'Could not "Delete movie" from: test_DeleteCreatedFile');
     // Recheck if deleted
     $obj = new Lists($this->getApiKey(), $this->getApiSecret());
     $obj->setSearch($this->getFileName());
     $response = $obj->send()->json();
     $this->validateResponse($response, 'Could not "Recheck if deleted" from: test_DeleteCreatedFile');
     $this->assertArrayHasKey('videos', $response);
     $this->assertCount(0, $response['videos']);
 }
示例#2
0
 /**
  * @depends test_cantUpdateMovieWithBothUrlAndDownload
  */
 public function test_canDeleteUploadMovie()
 {
     // Find movie
     $obj = new Lists($this->getApiKey(), $this->getApiSecret());
     $obj->setSearch($this->getFileName());
     $response = $obj->send()->json();
     $this->validateResponse($response, 'Could not "Find movie" from: test_DeleteUploadedFile');
     $this->assertArrayHasKey('videos', $response);
     $this->assertCount(1, $response['videos'], 'No file with name ' . $this->getFileName());
     $key = $response['videos'][0]['key'];
     // Update movie
     $obj = new Update($this->getApiKey(), $this->getApiSecret());
     $obj->setVideoKey($key);
     $obj->setTitle($this->getFileNameAfterUpdate());
     $response = $obj->send()->json();
     $this->validateResponse($response, 'Could not "Update movie" from: test_DeleteUploadedFile');
     // Find again
     $obj = new Lists($this->getApiKey(), $this->getApiSecret());
     $obj->setSearch($this->getFileNameAfterUpdate());
     $response = $obj->send()->json();
     $this->validateResponse($response, 'Could not "Find again" from: test_DeleteUploadedFile');
     $this->assertCount(1, $response['videos'], 'No videos with title ' . $this->getFileNameAfterUpdate());
     $key = $response['videos'][0]['key'];
     // Show video
     $obj = new Show($this->getApiKey(), $this->getApiSecret());
     $obj->setVideoKey($key);
     $response = $obj->send()->json();
     $this->validateResponse($response, 'Could not "Show video" from: test_DeleteUploadedFile');
     $this->assertArrayHasKey('video', $response);
     $this->assertArrayHasKey('mediatype', $response['video']);
     // Delete movie
     $deleter = new Delete($this->getApiKey(), $this->getApiSecret());
     $deleter->setVideoKey($key);
     $response = $deleter->send()->json();
     $this->validateResponse($response, 'Could not "Delete movie" from: test_DeleteUploadedFile');
     // Recheck if deleted
     $obj = new Lists($this->getApiKey(), $this->getApiSecret());
     $obj->setSearch($this->getFileNameAfterUpdate());
     $response = $obj->send()->json();
     $this->validateResponse($response, 'Could not "Recheck if deleted" from: test_DeleteUploadedFile');
     $this->assertArrayHasKey('status', $response);
     $this->assertArrayHasKey('videos', $response);
     $this->assertEquals(Lists::STATUS_OK, $response['status']);
     $this->assertCount(0, $response['videos']);
 }