113 $file_id =
'my_file_id';
114 $file_name =
'testfile.txt';
115 $file_mime_type =
'application/base64';
118 $r =
new DummyIDGenerator($file_id);
119 $identification = $r->getUniqueResourceIdentification();
122 $this->storage_handler->expects($this->once())
123 ->method(
'getIdentificationGenerator')
126 $this->resource_repository->expects($this->once())
128 ->with($identification)
129 ->willReturn(
new StorableFileResource($identification));
131 $this->revision_repository->expects($this->once())
133 ->willReturn(
new UploadedFileRevision($identification,
$result));
135 $resource = $this->resource_builder->new(
$result);
136 $revision = $resource->getCurrentRevision();
138 $this->assertEquals($identification->serialize(), $resource->getIdentification()->serialize());
139 $this->assertEquals($file_id, $resource->getIdentification()->serialize());
140 $this->assertEquals($file_name,
$revision->getInformation()->getTitle());
141 $this->assertEquals($file_mime_type,
$revision->getInformation()->getMimeType());
142 $this->assertEquals($file_size,
$revision->getInformation()->getSize());
145 $this->resource_repository->expects($this->once())->method(
'store')->with($resource);
146 $this->storage_handler->expects($this->once())->method(
'storeUpload')->with(
$revision);
147 $this->revision_repository->expects($this->once())->method(
'store')->with(
$revision);
148 $this->information_repository->expects($this->once())->method(
'store')->with(
$revision->getInformation(),
$revision);
149 $this->resource_builder->store($resource);
getUploadResult(string $file_name, string $mime_type, int $size)