ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
PathGeneratorTest.php
Go to the documentation of this file.
1<?php
2
20
21require_once(__DIR__ . "/../AbstractTestBase.php");
22
27
33{
34 protected array $prohibited = [
35 "<", // (less than)
36 ">", // (greater than)
37 ":", // (colon - sometimes works, but is actually NTFS Alternate Data Streams)
38 "\"", // (double quote)
39 "\\", // (backslash)
40 "|", // (vertical bar or pipe)
41 "?", // (question mark)
42 "*", // (asterisk)
43 ];
44
45 public function testPathGeneratorV1(): void
46 {
47 $identification_generator = new UniqueIDIdentificationGenerator();
48 $identification = $identification_generator->getUniqueResourceIdentification();
49
50 $path_generator = new UUIDBasedPathGenerator();
51 $path = $path_generator->getPathFor($identification);
52 $this->assertGreaterThanOrEqual(strlen($identification->serialize()), strlen($path));
53 foreach ($this->prohibited as $value) {
54 $this->assertStringNotContainsString((string) $value, $path);
55 }
56
57 $new_identification = $path_generator->getIdentificationFor($path);
58 $this->assertSame($identification->serialize(), $new_identification->serialize());
59 }
60
61 public function testPathGeneratorV2(): void
62 {
63 $identification_generator = new UniqueIDIdentificationGenerator();
64 $identification = $identification_generator->getUniqueResourceIdentification();
65
66 $path_generator = new MaxNestingPathGenerator();
67 $path = $path_generator->getPathFor($identification);
68
69 foreach ($this->prohibited as $value) {
70 $this->assertStringNotContainsString((string) $value, $path);
71 }
72
73 $new_identification = $path_generator->getIdentificationFor($path);
74 $this->assertSame($identification->serialize(), $new_identification->serialize());
75 }
76}
$path
Definition: ltiservices.php:30
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...