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

Class DirectoryNestingTest. More...

+ Inheritance diagram for ILIAS\ResourceStorage\Revision\DirectoryNestingTest:
+ Collaboration diagram for ILIAS\ResourceStorage\Revision\DirectoryNestingTest:

Public Member Functions

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

Protected Member Functions

 setUp ()
 @inheritDoc More...
 
- 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

MockObject $file_system_mock
 
- Protected Attributes inherited from ILIAS\ResourceStorage\AbstractTestBase
DummyIDGenerator $id_generator
 
MockObject $db_mock
 

Private Member Functions

 withImplementation (StorageHandler $h, int $min, int $max)
 

Private Attributes

const int NESTING_256 = 256
 
const int NESTING_4096 = 4096
 
const int NESTING_281474976710656 = 281_474_976_710_656
 
const int COMBINATIONS = 16
 

Detailed Description

Member Function Documentation

◆ setUp()

ILIAS\ResourceStorage\Revision\DirectoryNestingTest::setUp ( )
protected

@inheritDoc

Reimplemented from ILIAS\ResourceStorage\AbstractTestBase.

Definition at line 47 of file DirectoryNestingTest.php.

47 : void
48 {
49 parent::setUp();
50 $this->file_system_mock = $this->createMock(Filesystem::class);
51 }

◆ testMaxNestingV1()

ILIAS\ResourceStorage\Revision\DirectoryNestingTest::testMaxNestingV1 ( )

Definition at line 74 of file DirectoryNestingTest.php.

74 : void
75 {
76 $storage_handler = new FileSystemStorageHandler($this->file_system_mock, 2);
77 $this->withImplementation($storage_handler, self::NESTING_256, self::NESTING_281474976710656);
78 }
withImplementation(StorageHandler $h, int $min, int $max)

References ILIAS\ResourceStorage\Revision\DirectoryNestingTest\withImplementation().

+ Here is the call graph for this function:

◆ testMaxNestingV2()

ILIAS\ResourceStorage\Revision\DirectoryNestingTest::testMaxNestingV2 ( )

Definition at line 80 of file DirectoryNestingTest.php.

80 : void
81 {
82 $storage_handler = new MaxNestingFileSystemStorageHandler($this->file_system_mock, 2);
83 $this->withImplementation($storage_handler, self::NESTING_4096 - 1, self::NESTING_4096);
84 }

References ILIAS\ResourceStorage\Revision\DirectoryNestingTest\withImplementation().

+ Here is the call graph for this function:

◆ withImplementation()

ILIAS\ResourceStorage\Revision\DirectoryNestingTest::withImplementation ( StorageHandler  $h,
int  $min,
int  $max 
)
private

Definition at line 53 of file DirectoryNestingTest.php.

53 : void
54 {
55 $id_generator = $h->getIdentificationGenerator();
56
57 for ($x = 0; $x < 100; $x++) {
59 $path = $h->getContainerPathWithoutBase($random_id);
60 $path_elements = explode("/", $h->getContainerPathWithoutBase($random_id));
61 $first_element = end($path_elements);
62 $last_path_element = end($path_elements);
63 foreach ($path_elements as $path_element) {
64 $characters = strlen($path_element);
65 $possible_combinations = self::COMBINATIONS ** $characters;
66 if ($path_element !== $last_path_element) {
67 $this->assertLessThanOrEqual($max, $possible_combinations);
68 $this->assertGreaterThan($min, $possible_combinations);
69 }
70 }
71 }
72 }
$path
Definition: ltiservices.php:30

References ILIAS\ResourceStorage\AbstractTestBase\$id_generator, $path, ILIAS\ResourceStorage\StorageHandler\StorageHandler\getContainerPathWithoutBase(), ILIAS\ResourceStorage\StorageHandler\StorageHandler\getIdentificationGenerator(), and ILIAS\ResourceStorage\DummyIDGenerator\getUniqueResourceIdentification().

Referenced by ILIAS\ResourceStorage\Revision\DirectoryNestingTest\testMaxNestingV1(), and ILIAS\ResourceStorage\Revision\DirectoryNestingTest\testMaxNestingV2().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Field Documentation

◆ $file_system_mock

MockObject ILIAS\ResourceStorage\Revision\DirectoryNestingTest::$file_system_mock
protected

Definition at line 44 of file DirectoryNestingTest.php.

◆ COMBINATIONS

const int ILIAS\ResourceStorage\Revision\DirectoryNestingTest::COMBINATIONS = 16
private

Definition at line 40 of file DirectoryNestingTest.php.

◆ NESTING_256

const int ILIAS\ResourceStorage\Revision\DirectoryNestingTest::NESTING_256 = 256
private

Definition at line 37 of file DirectoryNestingTest.php.

◆ NESTING_281474976710656

const int ILIAS\ResourceStorage\Revision\DirectoryNestingTest::NESTING_281474976710656 = 281_474_976_710_656
private

Definition at line 39 of file DirectoryNestingTest.php.

◆ NESTING_4096

const int ILIAS\ResourceStorage\Revision\DirectoryNestingTest::NESTING_4096 = 4096
private

Definition at line 38 of file DirectoryNestingTest.php.


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