ILIAS  trunk Revision v11.0_alpha-1811-gd2d5443e411
All Data Structures Namespaces Files Functions Variables Enumerations Enumerator Modules Pages
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 ()
 
- Protected Member Functions inherited from ILIAS\ResourceStorage\AbstractTestBase
 setUp ()
 
 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 NESTING_256 = 256
 
const NESTING_4096 = 4096
 
const NESTING_65536 = 65536
 
const NESTING_4294967296 = 4_294_967_296
 
const NESTING_281474976710656 = 281_474_976_710_656
 
const MAX_NESTING = self::NESTING_65536
 
const MIN_NESTING = self::NESTING_256
 
const COMBINATIONS = 16
 

Detailed Description

Member Function Documentation

◆ setUp()

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

Definition at line 75 of file DirectoryNestingTest.php.

75  : void
76  {
77  parent::setUp();
78  $this->file_system_mock = $this->createMock(Filesystem::class);
79  }

◆ testMaxNestingV1()

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

Definition at line 102 of file DirectoryNestingTest.php.

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

102  : void
103  {
104  $storage_handler = new FileSystemStorageHandler($this->file_system_mock, 2);
105  $this->withImplementation($storage_handler, self::NESTING_256, self::NESTING_281474976710656);
106  }
withImplementation(StorageHandler $h, int $min, int $max)
+ Here is the call graph for this function:

◆ testMaxNestingV2()

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

Definition at line 108 of file DirectoryNestingTest.php.

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

108  : void
109  {
110  $storage_handler = new MaxNestingFileSystemStorageHandler($this->file_system_mock, 2);
111  $this->withImplementation($storage_handler, self::NESTING_4096 - 1, self::NESTING_4096);
112  }
withImplementation(StorageHandler $h, int $min, int $max)
+ Here is the call graph for this function:

◆ withImplementation()

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

Definition at line 81 of file DirectoryNestingTest.php.

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().

81  : void
82  {
83  $id_generator = $h->getIdentificationGenerator();
84 
85  for ($x = 0; $x < 100; $x++) {
87  $path = $h->getContainerPathWithoutBase($random_id);
88  $path_elements = explode("/", $h->getContainerPathWithoutBase($random_id));
89  $first_element = end($path_elements);
90  $last_path_element = end($path_elements);
91  foreach ($path_elements as $path_element) {
92  $characters = strlen($path_element);
93  $possible_combinations = self::COMBINATIONS ** $characters;
94  if ($path_element !== $last_path_element) {
95  $this->assertLessThanOrEqual($max, $possible_combinations);
96  $this->assertGreaterThan($min, $possible_combinations);
97  }
98  }
99  }
100  }
$path
Definition: ltiservices.php:29
+ 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 72 of file DirectoryNestingTest.php.

◆ COMBINATIONS

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

Definition at line 68 of file DirectoryNestingTest.php.

◆ MAX_NESTING

const ILIAS\ResourceStorage\Revision\DirectoryNestingTest::MAX_NESTING = self::NESTING_65536
private

Definition at line 60 of file DirectoryNestingTest.php.

◆ MIN_NESTING

const ILIAS\ResourceStorage\Revision\DirectoryNestingTest::MIN_NESTING = self::NESTING_256
private

Definition at line 64 of file DirectoryNestingTest.php.

◆ NESTING_256

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

Definition at line 40 of file DirectoryNestingTest.php.

◆ NESTING_281474976710656

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

Definition at line 56 of file DirectoryNestingTest.php.

◆ NESTING_4096

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

Definition at line 44 of file DirectoryNestingTest.php.

◆ NESTING_4294967296

const ILIAS\ResourceStorage\Revision\DirectoryNestingTest::NESTING_4294967296 = 4_294_967_296
private

Definition at line 52 of file DirectoryNestingTest.php.

◆ NESTING_65536

const ILIAS\ResourceStorage\Revision\DirectoryNestingTest::NESTING_65536 = 65536
private

Definition at line 48 of file DirectoryNestingTest.php.


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