111 : void
112 {
113 $file_id = 'my_file_id';
114 $file_name = 'testfile.txt';
115 $file_mime_type = 'application/base64';
116 $file_size = 256;
117
118 $r = new DummyIDGenerator($file_id);
119 $identification = $r->getUniqueResourceIdentification();
121
122 $this->storage_handler->expects($this->once())
123 ->method('getIdentificationGenerator')
124 ->willReturn($r);
125
126 $this->resource_repository->expects($this->once())
127 ->method('blank')
128 ->with($identification)
129 ->willReturn(new StorableFileResource($identification));
130
131 $this->revision_repository->expects($this->once())
132 ->method('blank')
133 ->willReturn(
new UploadedFileRevision($identification,
$result));
134
135 $resource = $this->resource_builder->new(
$result);
136 $revision = $resource->getCurrentRevision();
137
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());
143
144
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);
150 }
getUploadResult(string $file_name, string $mime_type, int $size)