ILIAS  release_8 Revision v8.24
ilCtrlSingleClassPathTest Class Reference

This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Learning e.V. More...

+ Inheritance diagram for ilCtrlSingleClassPathTest:
+ Collaboration diagram for ilCtrlSingleClassPathTest:

Public Member Functions

 testSinglePathWithUnknownClass ()
 
 testSinglePathWithoutBaseClass ()
 
 testSinglePathWithContextBaseClass ()
 
 testSinglePathWithProvidedBaseClass ()
 
 testSinglePathWithSameTargetClass ()
 
 testSinglePathWithEmptyTargetClassString ()
 
 testSinglePathBaseclassPriority ()
 

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

This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Learning e.V.

ILIAS is licensed with the GPL-3.0, see https://www.gnu.org/licenses/gpl-3.0.en.html You should have received a copy of said license along with the source code, too.

If this is not the case or you just want to try ILIAS, you'll find us at: https://www.ilias.de https://github.com/ILIAS-eLearning Class ilCtrlSingleClassPathTest

Author
Thibeau Fuhrer thibe.nosp@m.au@s.nosp@m.r.sol.nosp@m.utio.nosp@m.ns

Definition at line 27 of file ilCtrlSingleClassPathTest.php.

Member Function Documentation

◆ testSinglePathBaseclassPriority()

ilCtrlSingleClassPathTest::testSinglePathBaseclassPriority ( )

Definition at line 135 of file ilCtrlSingleClassPathTest.php.

135 : void
136 {
137 // mocked context that returns a cid-path containing a baseclass.
138 $context = $this->createMock(ilCtrlContextInterface::class);
140 ->method('getPath')
141 ->willReturn($this->getPath('0:2')) // ilCtrlBaseClass1TestGUI -> ilCtrlCommandClass1TestGUI
142 ;
143
145 $this->structure,
146 $context,
147 ilCtrlBaseClass2TestGUI::class
148 );
149
150 // baseclasses should have the least priority, therefore the new cid-path
151 // must not be '1' (the cid of ilCtrlBaseClass2TestGUI) but as described,
152 // because the baseclass can also be called by ilCtrlCommandClass1TestGUI.
153 $this->assertEquals('0:2:1', $path->getCidPath());
154 }
getPath(string $cid_path=null)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
$path
Definition: ltiservices.php:32
$context
Definition: webdav.php:29

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

+ Here is the call graph for this function:

◆ testSinglePathWithContextBaseClass()

ilCtrlSingleClassPathTest::testSinglePathWithContextBaseClass ( )

Definition at line 66 of file ilCtrlSingleClassPathTest.php.

66 : void
67 {
68 // mocked context that returns a cid-path containing a baseclass.
69 $context = $this->createMock(ilCtrlContextInterface::class);
71 ->method('getPath')
72 ->willReturn($this->getPath('0:4'))
73 ;
74
76 $this->structure,
78 ilCtrlCommandClass1TestGUI::class
79 );
80
81 $this->assertEquals('0:2', $path->getCidPath());
82 }

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

+ Here is the call graph for this function:

◆ testSinglePathWithEmptyTargetClassString()

ilCtrlSingleClassPathTest::testSinglePathWithEmptyTargetClassString ( )

Definition at line 121 of file ilCtrlSingleClassPathTest.php.

121 : void
122 {
124 $this->structure,
125 $this->createMock(ilCtrlContextInterface::class),
126 ''
127 );
128
129 $this->assertNotNull($path->getException());
130 $this->expectException(ilCtrlException::class);
131 $this->expectExceptionMessage("Class '' was not found in the control structure, try `composer du` to read artifacts.");
132 throw $path->getException();
133 }

References $path.

◆ testSinglePathWithoutBaseClass()

ilCtrlSingleClassPathTest::testSinglePathWithoutBaseClass ( )

Definition at line 44 of file ilCtrlSingleClassPathTest.php.

44 : void
45 {
46 // mocked context that returns no cid-path.
47 $context = $this->createMock(ilCtrlContextInterface::class);
49 ->method('getPath')
50 ->willReturn($this->getPath(null))
51 ;
52
53 $target_class = ilCtrlCommandClass1TestGUI::class;
55 $this->structure,
57 $target_class
58 );
59
60 $this->assertNotNull($path->getException());
61 $this->expectException(ilCtrlException::class);
62 $this->expectExceptionMessage("ilCtrl cannot find a path for '$target_class' that reaches ''");
63 throw $path->getException();
64 }

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

+ Here is the call graph for this function:

◆ testSinglePathWithProvidedBaseClass()

ilCtrlSingleClassPathTest::testSinglePathWithProvidedBaseClass ( )

Definition at line 84 of file ilCtrlSingleClassPathTest.php.

84 : void
85 {
86 // mocked context that returns no cid-path
87 $context = $this->createMock(ilCtrlContextInterface::class);
89 ->method('getPath')
90 ->willReturn($this->getPath(null))
91 ;
92
94 $this->structure,
96 ilCtrlBaseClass1TestGUI::class
97 );
98
99 $this->assertEquals('0', $path->getCidPath());
100 }

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

+ Here is the call graph for this function:

◆ testSinglePathWithSameTargetClass()

ilCtrlSingleClassPathTest::testSinglePathWithSameTargetClass ( )

Definition at line 102 of file ilCtrlSingleClassPathTest.php.

102 : void
103 {
104 // mocked context that returns a cid-path that already
105 // contains the target class.
106 $context = $this->createMock(ilCtrlContextInterface::class);
108 ->method('getPath')
109 ->willReturn($this->getPath('1:2:3'))
110 ;
111
113 $this->structure,
114 $context,
115 ilCtrlCommandClass2TestGUI::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:

◆ testSinglePathWithUnknownClass()

ilCtrlSingleClassPathTest::testSinglePathWithUnknownClass ( )

Definition at line 29 of file ilCtrlSingleClassPathTest.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.


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