ILIAS  release_8 Revision v8.24
ilCtrlArrayClassPathTest Class Reference

Class ilCtrlArrayClassPathTest. More...

+ Inheritance diagram for ilCtrlArrayClassPathTest:
+ Collaboration diagram for ilCtrlArrayClassPathTest:

Public Member Functions

 testArrayPathWithEmptyTargets ()
 
 testArrayPathWithUnknownTargetClass ()
 
 testArrayPathWithUnrelatedTargets ()
 
 testArrayPathWithoutBaseClass ()
 
 testArrayPathWithProvidedBaseClass ()
 
 testArrayPathWithContextBaseClass ()
 
 testArrayPathWithContextAndProvidedBaseClass ()
 

Additional Inherited Members

- Protected Member Functions inherited from ilCtrlPathTestBase
 setUp ()
 @inheritDoc More...
 
 getPath (string $cid_path=null)
 
- Protected Attributes inherited from ilCtrlPathTestBase
ilCtrlStructureInterface $structure
 

Detailed Description

Member Function Documentation

◆ testArrayPathWithContextAndProvidedBaseClass()

ilCtrlArrayClassPathTest::testArrayPathWithContextAndProvidedBaseClass ( )

Definition at line 121 of file ilCtrlArrayClassPathTest.php.

121 : void
122 {
123 // mocked context that will return path with first base-class
124 // that can call command class 1-
125 $context = $this->createMock(ilCtrlContextInterface::class);
127 ->method('getPath')
128 ->willReturn($this->getPath('0:2'));
129
130 $new_base_class = ilCtrlBaseClass2TestGUI::class;
131 $first_target_class = ilCtrlCommandClass1TestGUI::class;
132 $second_target_class = ilCtrlCommandClass2TestGUI::class;
134 $this->structure,
135 $context,
136 [$new_base_class, $first_target_class, $second_target_class]
137 );
138
139 $this->assertEquals('1:2:3', $path->getCidPath());
140 }
Class ilCtrlArrayClassPath.
getPath(string $cid_path=null)
$path
Definition: ltiservices.php:32
$context
Definition: webdav.php:29

References $context, $path, and ilCtrlPathTestBase\getPath().

+ Here is the call graph for this function:

◆ testArrayPathWithContextBaseClass()

ilCtrlArrayClassPathTest::testArrayPathWithContextBaseClass ( )

Definition at line 102 of file ilCtrlArrayClassPathTest.php.

102 : void
103 {
104 // mocked context that will return path with base-class.
105 $context = $this->createMock(ilCtrlContextInterface::class);
107 ->method('getPath')
108 ->willReturn($this->getPath('1:4'));
109
110 $first_target_class = ilCtrlCommandClass1TestGUI::class;
111 $second_target_class = ilCtrlCommandClass2TestGUI::class;
113 $this->structure,
114 $context,
115 [$first_target_class, $second_target_class]
116 );
117
118 $this->assertEquals('1:2:3', $path->getCidPath());
119 }

References $context, $path, and ilCtrlPathTestBase\getPath().

+ Here is the call graph for this function:

◆ testArrayPathWithEmptyTargets()

ilCtrlArrayClassPathTest::testArrayPathWithEmptyTargets ( )

Definition at line 15 of file ilCtrlArrayClassPathTest.php.

15 : void
16 {
18 $this->structure,
19 $this->createMock(ilCtrlContextInterface::class),
20 []
21 );
22
23 $this->assertNotNull($path->getException());
24 $this->expectException(ilCtrlException::class);
25 $this->expectExceptionMessage(ilCtrlArrayClassPath::class . '::getCidPathByArray must be provided with a list of classes.');
26 throw $path->getException();
27 }

References $path.

◆ testArrayPathWithoutBaseClass()

ilCtrlArrayClassPathTest::testArrayPathWithoutBaseClass ( )

Definition at line 60 of file ilCtrlArrayClassPathTest.php.

60 : void
61 {
62 // mocked context that will return path without cid-path.
63 $context = $this->createMock(ilCtrlContextInterface::class);
65 ->method('getPath')
66 ->willReturn($this->getPath(null));
67
68 $first_target_class = ilCtrlCommandClass1TestGUI::class;
69 $second_target_class = ilCtrlCommandClass2TestGUI::class;
71 $this->structure,
73 [$first_target_class, $second_target_class]
74 );
75
76 $this->assertNotNull($path->getException());
77 $this->expectException(ilCtrlException::class);
78 $this->expectExceptionMessage("Class '$first_target_class' is not a baseclass and the current context doesn't have one either.");
79 throw $path->getException();
80 }

References $context, $path, and ilCtrlPathTestBase\getPath().

+ Here is the call graph for this function:

◆ testArrayPathWithProvidedBaseClass()

ilCtrlArrayClassPathTest::testArrayPathWithProvidedBaseClass ( )

Definition at line 82 of file ilCtrlArrayClassPathTest.php.

82 : void
83 {
84 // mocked context that will return path without cid-path.
85 $context = $this->createMock(ilCtrlContextInterface::class);
87 ->method('getPath')
88 ->willReturn($this->getPath(null));
89
90 $base_class = ilCtrlBaseClass2TestGUI::class;
91 $first_target_class = ilCtrlCommandClass1TestGUI::class;
92 $second_target_class = ilCtrlCommandClass2TestGUI::class;
94 $this->structure,
96 [$base_class, $first_target_class, $second_target_class]
97 );
98
99 $this->assertEquals('1:2:3', $path->getCidPath());
100 }

References $context, $path, and ilCtrlPathTestBase\getPath().

+ Here is the call graph for this function:

◆ testArrayPathWithUnknownTargetClass()

ilCtrlArrayClassPathTest::testArrayPathWithUnknownTargetClass ( )

Definition at line 29 of file ilCtrlArrayClassPathTest.php.

29 : void
30 {
31 $invalid_class = ilCtrlInvalidGuiClass::class;
33 $this->structure,
34 $this->createMock(ilCtrlContextInterface::class),
35 [$invalid_class]
36 );
37
38 $this->assertNotNull($path->getException());
39 $this->expectException(ilCtrlException::class);
40 $this->expectExceptionMessage("Class '$invalid_class' was not found in the control structure, try `composer du` to read artifacts.");
41 throw $path->getException();
42 }

References $path.

◆ testArrayPathWithUnrelatedTargets()

ilCtrlArrayClassPathTest::testArrayPathWithUnrelatedTargets ( )

Definition at line 44 of file ilCtrlArrayClassPathTest.php.

44 : void
45 {
46 $parent_class = ilCtrlBaseClass2TestGUI::class;
47 $child_class = ilCtrlCommandClass2TestGUI::class;
49 $this->structure,
50 $this->createMock(ilCtrlContextInterface::class),
51 [$parent_class, $child_class]
52 );
53
54 $this->assertNotNull($path->getException());
55 $this->expectException(ilCtrlException::class);
56 $this->expectExceptionMessage("Class '$child_class' is not a child of '$parent_class'.");
57 throw $path->getException();
58 }

References $path.


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