Class FlavorTest.
More...
Class FlavorTest.
- Author
- Fabian Schmid fabia.nosp@m.n@sr.nosp@m..solu.nosp@m.tion.nosp@m.s
Definition at line 46 of file FlavourTest.php.
◆ setUp()
ILIAS\ResourceStorage\Flavours\FlavourTest::setUp |
( |
| ) |
|
|
protected |
Definition at line 59 of file FlavourTest.php.
62 $storage_handler_mock = $this->createMock(StorageHandler::class);
63 $storage_handler_mock->method(
'isPrimary')->willReturn(
true);
64 $this->storage_handler_factory =
new StorageHandlerFactory([
67 $this->flavour_repo = $this->createMock(FlavourRepository::class);
68 $this->resource_builder = $this->createMock(ResourceBuilder::class);
69 $this->stream_access =
new StreamAccess(self::BASE_DIR, $this->storage_handler_factory);
Interface Observer Contains several chained tasks and infos about them.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
◆ testDefinitionVariantNameLengths()
ILIAS\ResourceStorage\Flavours\FlavourTest::testDefinitionVariantNameLengths |
( |
| ) |
|
Definition at line 73 of file FlavourTest.php.
75 $flavour_builder =
new FlavourBuilder(
77 $this->machine_factory,
78 $this->resource_builder,
79 $this->storage_handler_factory,
85 $flavour_definition = $this->createMock(FlavourDefinition::class);
86 $flavour_definition->expects($this->exactly(2))
87 ->method(
'getVariantName')
88 ->willReturn(str_repeat(
'a', 768));
90 $flavour_builder->has(
91 new ResourceIdentification(
'1'),
94 $this->assertTrue(
true);
97 $flavour_definition = $this->createMock(FlavourDefinition::class);
98 $flavour_definition->expects($this->exactly(2))
99 ->method(
'getVariantName')
100 ->willReturn(str_repeat(
'a', 769));
102 $this->expectException(\InvalidArgumentException::class);
103 $flavour_builder->has(
104 new ResourceIdentification(
'1'),
◆ testHasFlavour()
ILIAS\ResourceStorage\Flavours\FlavourTest::testHasFlavour |
( |
| ) |
|
Definition at line 109 of file FlavourTest.php.
112 $rid_one =
new ResourceIdentification(
'1');
113 $rid_two =
new ResourceIdentification(
'2');
114 $flavour_builder =
new FlavourBuilder(
116 $this->machine_factory,
117 $this->resource_builder,
118 $this->storage_handler_factory,
119 $this->stream_access,
124 $flavour_definition = $this->createMock(FlavourDefinition::class);
125 $flavour_definition->expects($this->exactly(4))
126 ->method(
'getVariantName')
127 ->willReturn(
'short');
131 [[$rid_one, 0, $flavour_definition],
false],
132 [[$rid_two, 0, $flavour_definition],
true],
135 ->expects($this->exactly(2))
137 ->willReturnCallback(
138 function ($rid, $mid, $def) use (&$consecutive) {
139 [$expected, $ret] = array_shift($consecutive);
140 $this->assertEquals($expected, [$rid, $mid, $def]);
147 $flavour_builder->has(
153 $flavour_builder->has(
◆ testNewFlavour()
ILIAS\ResourceStorage\Flavours\FlavourTest::testNewFlavour |
( |
| ) |
|
Definition at line 160 of file FlavourTest.php.
References ILIAS\Filesystem\Stream\Streams\ofString().
163 $rid_one =
new ResourceIdentification(
'1');
164 $flavour_builder =
new FlavourBuilder(
166 $this->machine_factory,
167 $this->resource_builder,
168 $this->storage_handler_factory,
169 $this->stream_access,
174 $flavour_definition = $this->createMock(FlavourDefinition::class);
176 ->method(
'getVariantName')
177 ->willReturn(
'short');
179 $this->flavour_repo->expects($this->once())
181 ->with($rid_one, 0, $flavour_definition)
184 $this->resource_builder->expects($this->once())
189 $revision = $this->createMock(FileRevision::class);
191 $revision->expects($this->once())
192 ->method(
'getInformation')
193 ->willReturn($this->createMock(FileInformation::class));
197 $resource = $this->createMock(StorableResource::class);
199 $this->resource_builder->expects($this->once())
202 ->willReturn($resource);
205 ->method(
'getCurrentRevision')
206 ->willReturn($revision);
209 $this->resource_builder->expects($this->once())
210 ->method(
'extractStream')
212 ->willReturn($stream);
216 $flavour = $flavour_builder->get(
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);
static ofString(string $string)
Creates a new stream with an initial value.
◆ $flavour_repo
MockObject ILIAS\ResourceStorage\Flavours\FlavourTest::$flavour_repo |
|
private |
◆ $machine_factory
Factory ILIAS\ResourceStorage\Flavours\FlavourTest::$machine_factory |
|
private |
◆ $resource_builder
MockObject ILIAS\ResourceStorage\Flavours\FlavourTest::$resource_builder |
◆ $storage_handler_factory
ILIAS\ResourceStorage\Flavours\FlavourTest::$storage_handler_factory |
|
protected |
◆ $stream_access
StreamAccess ILIAS\ResourceStorage\Flavours\FlavourTest::$stream_access |
|
private |
◆ BASE_DIR
const string ILIAS\ResourceStorage\Flavours\FlavourTest::BASE_DIR = '/var' |
|
private |
The documentation for this class was generated from the following file: