ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
ilCtrlSingleClassPathTest Class Reference

Class ilCtrlSingleClassPathTest. 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

Member Function Documentation

◆ testSinglePathBaseclassPriority()

ilCtrlSingleClassPathTest::testSinglePathBaseclassPriority ( )

Definition at line 136 of file ilCtrlSingleClassPathTest.php.

136 : void
137 {
138 // mocked context that returns a cid-path containing a baseclass.
139 $context = $this->createMock(ilCtrlContextInterface::class);
141 ->method('getPath')
142 ->willReturn($this->getPath('0:2')) // ilCtrlBaseClass1TestGUI -> ilCtrlCommandClass1TestGUI
143 ;
144
146 $this->structure,
147 $context,
148 ilCtrlBaseClass2TestGUI::class
149 );
150
151 // baseclasses should have the least priority, therefore the new cid-path
152 // must not be '1' (the cid of ilCtrlBaseClass2TestGUI) but as described,
153 // because the baseclass can also be called by ilCtrlCommandClass1TestGUI.
154 $this->assertEquals('0:2:1', $path->getCidPath());
155 }
getPath(?string $cid_path=null)
Class ilCtrlSingleClassPath.
$path
Definition: ltiservices.php:30
$context
Definition: webdav.php:31

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

+ Here is the call graph for this function:

◆ testSinglePathWithContextBaseClass()

ilCtrlSingleClassPathTest::testSinglePathWithContextBaseClass ( )

Definition at line 67 of file ilCtrlSingleClassPathTest.php.

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

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

+ Here is the call graph for this function:

◆ testSinglePathWithEmptyTargetClassString()

ilCtrlSingleClassPathTest::testSinglePathWithEmptyTargetClassString ( )

Definition at line 122 of file ilCtrlSingleClassPathTest.php.

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

References $path.

◆ testSinglePathWithoutBaseClass()

ilCtrlSingleClassPathTest::testSinglePathWithoutBaseClass ( )

Definition at line 45 of file ilCtrlSingleClassPathTest.php.

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

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

+ Here is the call graph for this function:

◆ testSinglePathWithProvidedBaseClass()

ilCtrlSingleClassPathTest::testSinglePathWithProvidedBaseClass ( )

Definition at line 85 of file ilCtrlSingleClassPathTest.php.

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

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

+ Here is the call graph for this function:

◆ testSinglePathWithSameTargetClass()

ilCtrlSingleClassPathTest::testSinglePathWithSameTargetClass ( )

Definition at line 103 of file ilCtrlSingleClassPathTest.php.

103 : void
104 {
105 // mocked context that returns a cid-path that already
106 // contains the target class.
107 $context = $this->createMock(ilCtrlContextInterface::class);
109 ->method('getPath')
110 ->willReturn($this->getPath('1:2:3'))
111 ;
112
114 $this->structure,
115 $context,
116 ilCtrlCommandClass2TestGUI::class
117 );
118
119 $this->assertEquals('1:2:3', $path->getCidPath());
120 }

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

+ Here is the call graph for this function:

◆ testSinglePathWithUnknownClass()

ilCtrlSingleClassPathTest::testSinglePathWithUnknownClass ( )

Definition at line 30 of file ilCtrlSingleClassPathTest.php.

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

References $path.


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