ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
ResourceBuilderTest.php
Go to the documentation of this file.
1<?php
2
20
22
28{
29 public function testNewUpload(): 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
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 }
69}
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
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...