Exemplo n.º 1
0
 public function test_Should_ReturnFalse_When_RollbackCommandFails()
 {
     Storage::shouldReceive('put')->once()->andReturn(0);
     $deployCommander = new StorageDeployCommander();
     $result = $deployCommander->rollback(new App\Models\Deployment());
     $this->assertFalse($result, 'Expected rollback command to fail.');
 }
 public function testUpload()
 {
     $this->uploadedFileMock->expects($this->any())->method('getClientOriginalName')->willReturn('original_name');
     $this->uploadedFileMock->expects($this->once())->method('getRealPath')->willReturn(tempnam('tmp', 'test'));
     $this->requestMock->expects($this->once())->method('file')->willReturn($this->uploadedFileMock);
     \Storage::shouldReceive('put')->once();
     $mediaUploader = new UploadFileWhenAddingMedia($this->requestMock);
     $mediaUploader->creating($this->mediaMock);
 }
Exemplo n.º 3
0
 /**
  * @group basic
  * @group upload-test
  */
 public function test_uploads_can_have_an_existing_series_id()
 {
     $this->seed();
     Storage::shouldReceive('disk->put');
     AWS::shouldReceive('createClient->getCommand');
     AWS::shouldReceive('createClient->createPresignedRequest->getUri');
     AWS::shouldReceive('createClient->getObjectUrl')->andReturn('value');
     AWS::shouldReceive('Lambda');
     AWS::shouldReceive('Lambda->invokeAsync');
     $series = factory(App\Models\Series::class)->create(['user_id' => 1]);
     $file = new Symfony\Component\HttpFoundation\File\UploadedFile(storage_path('test files/test-comic-6-pages.cbz'), 'test-comic-6-pages.cbz', 'application/zip', 1000, null, TRUE);
     $req = $this->postWithFile($this->basic_upload_endpoint, ["series_id" => $series->id, "comic_id" => Uuid::uuid4()->toString(), "series_title" => "test", "series_start_year" => "2015", "comic_issue" => 1], ['Authorization' => 'Bearer ' . $this->test_basic_access_token], ['file' => $file]);
     $this->assertResponseStatus(201);
 }
 public function testRemoval()
 {
     \Storage::shouldReceive('delete')->once();
     $mediaUploader = new RemoveFileWhenDeletingMedia($this->requestMock);
     $mediaUploader->deleting($this->mediaMock);
 }