160 : void
161 {
162
163 $rid_one = new ResourceIdentification('1');
164 $flavour_builder = new FlavourBuilder(
165 $this->flavour_repo,
166 $this->machine_factory,
167 $this->resource_builder,
168 $this->storage_handler_factory,
169 $this->stream_access,
170 new Subject()
171 );
172
173
174 $flavour_definition = $this->createMock(FlavourDefinition::class);
175 $flavour_definition
176 ->method('getVariantName')
177 ->willReturn('short');
178
179 $this->flavour_repo->expects($this->once())
180 ->method('has')
181 ->with($rid_one, 0, $flavour_definition)
182 ->willReturn(false);
183
184 $this->resource_builder->expects($this->once())
185 ->method('has')
186 ->with($rid_one)
187 ->willReturn(true);
188
189 $revision = $this->createMock(FileRevision::class);
190
191 $revision->expects($this->once())
192 ->method('getInformation')
193 ->willReturn($this->createMock(FileInformation::class));
194
196
197 $resource = $this->createMock(StorableResource::class);
198
199 $this->resource_builder->expects($this->once())
200 ->method('get')
201 ->with($rid_one)
202 ->willReturn($resource);
203
204 $resource
205 ->method('getCurrentRevision')
206 ->willReturn($revision);
207
208
209 $this->resource_builder->expects($this->once())
210 ->method('extractStream')
211 ->with($revision)
212 ->willReturn($stream);
213
214
215
216 $flavour = $flavour_builder->get(
217 $rid_one,
218 $flavour_definition
219 );
220 $this->assertInstanceOf(Flavour::class, $flavour);
221 $stream_resolvers = $flavour->getStreamResolvers();
222 $this->assertCount(1, $stream_resolvers);
223 $first_stream_access = $stream_resolvers[0];
224 $this->assertInstanceOf(StreamResolver::class, $first_stream_access);
225 $resolved_stream = $first_stream_access->getStream();
226 $this->assertSame('empty', (string) $resolved_stream);
227 }
static ofString(string $string)
Creates a new stream with an initial value.