ILIAS  release_7 Revision v7.30-3-g800a261c036
All Data Structures Namespaces Files Functions Variables Modules Pages
ResourceBuilderTest.php
Go to the documentation of this file.
1 <?php
2 
4 
6 
12 {
13 
14  public function testNewUpload() : void
15  {
16  // EXPECTED VALUES
17  $expected_file_name = 'info.xml';
18  $expected_owner_id = 6;
19  $expected_version_number = 99;
20  $expected_mime_type = 'text/xml';
21  $expected_size = 128;
22 
24  $this->storage_handler_factory,
25  $this->revision_repository,
26  $this->resource_repository,
27  $this->information_repository,
28  $this->stakeholder_repository,
29  $this->locking
30  );
31 
32  // MOCK
33  list($upload_result, $info_resolver, $identification) = $this->mockResourceAndRevision(
34  $expected_file_name,
35  $expected_mime_type,
36  $expected_size, $expected_version_number, $expected_owner_id
37  );
38 
39  // RUN
40  $resource = $resource_builder->new(
42  $info_resolver
43  );
44 
45  $this->assertEquals($identification->serialize(), $resource->getIdentification()->serialize());
46  $this->assertEquals($expected_version_number, $resource->getCurrentRevision()->getVersionNumber());
47  $this->assertEquals($expected_version_number, $resource->getMaxRevision());
48  $this->assertEquals($expected_file_name, $resource->getCurrentRevision()->getTitle());
49  $this->assertEquals($expected_owner_id, $resource->getCurrentRevision()->getOwnerId());
50  $this->assertEquals($expected_file_name, $resource->getCurrentRevision()->getInformation()->getTitle());
51  $this->assertEquals($expected_mime_type, $resource->getCurrentRevision()->getInformation()->getMimeType());
52  $this->assertEquals($expected_size, $resource->getCurrentRevision()->getInformation()->getSize());
53 
54  }
55 }
56 
mockResourceAndRevision(string $expected_file_name, string $expected_mime_type, int $expected_size, int $expected_version_number, int $expected_owner_id)