ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
ILIAS\ResourceStorage\Resource\ResourceBuilderTest Class Reference

Class ResourceBuilderTest. More...

+ Inheritance diagram for ILIAS\ResourceStorage\Resource\ResourceBuilderTest:
+ Collaboration diagram for ILIAS\ResourceStorage\Resource\ResourceBuilderTest:

Public Member Functions

 testNewUpload ()
 
- Public Member Functions inherited from ILIAS\ResourceStorage\AbstractTestBase
 getDummyStream ()
 

Additional Inherited Members

- Data Fields inherited from ILIAS\ResourceStorage\AbstractBaseResourceBuilderTestCase
MockObject $flavour_repository
 
- Protected Member Functions inherited from ILIAS\ResourceStorage\AbstractBaseResourceBuilderTestCase
 setUp ()
 @inheritDoc More...
 
 mockResourceAndRevision (string $expected_file_name, string $expected_mime_type, int $expected_size, int $expected_version_number, int $expected_owner_id)
 
- Protected Member Functions inherited from ILIAS\ResourceStorage\AbstractTestBase
 setUp ()
 @inheritDoc More...
 
 getDummyUploadResult (string $file_name, string $mime_type, int $size)
 
 getDummyFileRevision (ResourceIdentification $id)
 
- Protected Attributes inherited from ILIAS\ResourceStorage\AbstractBaseResourceBuilderTestCase
MockObject $revision
 
MockObject $information
 
 $upload_result
 
MockObject $information_repository
 
MockObject $resource_repository
 
MockObject $collection_repository
 
MockObject $revision_repository
 
MockObject $storage_handler
 
ResourceBuilder $resource_builder
 
MockObject $stakeholder_repository
 
MockObject $locking
 
MockObject $storage_handler_factory
 
MockObject $stream_access
 
Repositories $repositories
 
- Protected Attributes inherited from ILIAS\ResourceStorage\AbstractTestBase
DummyIDGenerator $id_generator
 
MockObject $db_mock
 

Detailed Description

Member Function Documentation

◆ testNewUpload()

ILIAS\ResourceStorage\Resource\ResourceBuilderTest::testNewUpload ( )

Definition at line 29 of file ResourceBuilderTest.php.

29 : void
30 {
31 // EXPECTED VALUES
32 $expected_file_name = 'info.xml';
33 $expected_owner_id = 6;
34 $expected_version_number = 99;
35 $expected_mime_type = 'text/xml';
36 $expected_size = 128;
37
38 $resource_builder = new ResourceBuilder(
39 $this->storage_handler_factory,
40 $this->repositories,
41 $this->locking,
42 $this->stream_access
43 );
44
45 // MOCK
46 [$upload_result, $info_resolver, $identification] = $this->mockResourceAndRevision(
47 $expected_file_name,
48 $expected_mime_type,
49 $expected_size,
50 $expected_version_number,
51 $expected_owner_id
52 );
53
54 // RUN
55 $resource = $resource_builder->new(
57 $info_resolver
58 );
59
60 $this->assertEquals($identification->serialize(), $resource->getIdentification()->serialize());
61 $this->assertSame($expected_version_number, $resource->getCurrentRevision()->getVersionNumber());
62 $this->assertSame($expected_version_number, $resource->getMaxRevision());
63 $this->assertSame($expected_file_name, $resource->getCurrentRevision()->getTitle());
64 $this->assertSame($expected_owner_id, $resource->getCurrentRevision()->getOwnerId());
65 $this->assertSame($expected_file_name, $resource->getCurrentRevision()->getInformation()->getTitle());
66 $this->assertSame($expected_mime_type, $resource->getCurrentRevision()->getInformation()->getMimeType());
67 $this->assertSame($expected_size, $resource->getCurrentRevision()->getInformation()->getSize());
68 }
mockResourceAndRevision(string $expected_file_name, string $expected_mime_type, int $expected_size, int $expected_version_number, int $expected_owner_id)
new(UploadResult $result, InfoResolver $info_resolver, ResourceType $type=ResourceType::SINGLE_FILE)
@inheritDoc

References ILIAS\ResourceStorage\AbstractBaseResourceBuilderTestCase\$resource_builder, ILIAS\ResourceStorage\AbstractBaseResourceBuilderTestCase\$upload_result, ILIAS\ResourceStorage\AbstractBaseResourceBuilderTestCase\mockResourceAndRevision(), and ILIAS\ResourceStorage\Resource\ResourceBuilder\new().

+ Here is the call graph for this function:

The documentation for this class was generated from the following file: