Class ilCtrlArrayClassPathTest.
More...
◆ testArrayPathWithContextAndProvidedBaseClass()
ilCtrlArrayClassPathTest::testArrayPathWithContextAndProvidedBaseClass |
( |
| ) |
|
Definition at line 135 of file ilCtrlArrayClassPathTest.php.
135 : void
136 {
137
138
139 $context = $this->createMock(ilCtrlContextInterface::class);
141 ->method('getPath')
142 ->willReturn($this->
getPath(
'0:2'));
143
144 $new_base_class = ilCtrlBaseClass2TestGUI::class;
145 $first_target_class = ilCtrlCommandClass1TestGUI::class;
146 $second_target_class = ilCtrlCommandClass2TestGUI::class;
148 $this->structure,
150 [$new_base_class, $first_target_class, $second_target_class]
151 );
152
153 $this->assertEquals(
'1:2:3',
$path->getCidPath());
154 }
Class ilCtrlArrayClassPath.
getPath(?string $cid_path=null)
References $context, $path, and ilCtrlPathTestBase\getPath().
◆ testArrayPathWithContextBaseClass()
ilCtrlArrayClassPathTest::testArrayPathWithContextBaseClass |
( |
| ) |
|
Definition at line 116 of file ilCtrlArrayClassPathTest.php.
116 : void
117 {
118
119 $context = $this->createMock(ilCtrlContextInterface::class);
121 ->method('getPath')
122 ->willReturn($this->
getPath(
'1:4'));
123
124 $first_target_class = ilCtrlCommandClass1TestGUI::class;
125 $second_target_class = ilCtrlCommandClass2TestGUI::class;
127 $this->structure,
129 [$first_target_class, $second_target_class]
130 );
131
132 $this->assertEquals(
'1:2:3',
$path->getCidPath());
133 }
References $context, $path, and ilCtrlPathTestBase\getPath().
◆ testArrayPathWithEmptyTargets()
ilCtrlArrayClassPathTest::testArrayPathWithEmptyTargets |
( |
| ) |
|
Definition at line 29 of file ilCtrlArrayClassPathTest.php.
29 : void
30 {
32 $this->structure,
33 $this->createMock(ilCtrlContextInterface::class),
34 []
35 );
36
37 $this->assertNotNull(
$path->getException());
38 $this->expectException(ilCtrlException::class);
39 $this->expectExceptionMessage(ilCtrlArrayClassPath::class . '::getCidPathByArray must be provided with a list of classes.');
40 throw $path->getException();
41 }
References $path.
◆ testArrayPathWithoutBaseClass()
ilCtrlArrayClassPathTest::testArrayPathWithoutBaseClass |
( |
| ) |
|
Definition at line 74 of file ilCtrlArrayClassPathTest.php.
74 : void
75 {
76
77 $context = $this->createMock(ilCtrlContextInterface::class);
79 ->method('getPath')
80 ->willReturn($this->
getPath(
null));
81
82 $first_target_class = ilCtrlCommandClass1TestGUI::class;
83 $second_target_class = ilCtrlCommandClass2TestGUI::class;
85 $this->structure,
87 [$first_target_class, $second_target_class]
88 );
89
90 $this->assertNotNull(
$path->getException());
91 $this->expectException(ilCtrlException::class);
92 $this->expectExceptionMessage("Class '$first_target_class' is not a baseclass and the current context doesn't have one either.");
93 throw $path->getException();
94 }
References $context, $path, and ilCtrlPathTestBase\getPath().
◆ testArrayPathWithProvidedBaseClass()
ilCtrlArrayClassPathTest::testArrayPathWithProvidedBaseClass |
( |
| ) |
|
Definition at line 96 of file ilCtrlArrayClassPathTest.php.
96 : void
97 {
98
99 $context = $this->createMock(ilCtrlContextInterface::class);
101 ->method('getPath')
102 ->willReturn($this->
getPath(
null));
103
104 $base_class = ilCtrlBaseClass2TestGUI::class;
105 $first_target_class = ilCtrlCommandClass1TestGUI::class;
106 $second_target_class = ilCtrlCommandClass2TestGUI::class;
108 $this->structure,
110 [$base_class, $first_target_class, $second_target_class]
111 );
112
113 $this->assertEquals(
'1:2:3',
$path->getCidPath());
114 }
References $context, $path, and ilCtrlPathTestBase\getPath().
◆ testArrayPathWithUnknownTargetClass()
ilCtrlArrayClassPathTest::testArrayPathWithUnknownTargetClass |
( |
| ) |
|
Definition at line 43 of file ilCtrlArrayClassPathTest.php.
43 : void
44 {
45 $invalid_class = ilCtrlInvalidGuiClass::class;
47 $this->structure,
48 $this->createMock(ilCtrlContextInterface::class),
49 [$invalid_class]
50 );
51
52 $this->assertNotNull(
$path->getException());
53 $this->expectException(ilCtrlException::class);
54 $this->expectExceptionMessage("Class '$invalid_class' was not found in the control structure, try `composer du` to read artifacts.");
55 throw $path->getException();
56 }
References $path.
◆ testArrayPathWithUnrelatedTargets()
ilCtrlArrayClassPathTest::testArrayPathWithUnrelatedTargets |
( |
| ) |
|
Definition at line 58 of file ilCtrlArrayClassPathTest.php.
58 : void
59 {
60 $parent_class = ilCtrlBaseClass2TestGUI::class;
61 $child_class = ilCtrlCommandClass2TestGUI::class;
63 $this->structure,
64 $this->createMock(ilCtrlContextInterface::class),
65 [$parent_class, $child_class]
66 );
67
68 $this->assertNotNull(
$path->getException());
69 $this->expectException(ilCtrlException::class);
70 $this->expectExceptionMessage("Class '$child_class' is not a child of '$parent_class'.");
71 throw $path->getException();
72 }
References $path.
The documentation for this class was generated from the following file: