ILIAS  trunk Revision v11.0_alpha-2662-g519ff7d528f
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 ()
 
 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.

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

136  : void
137  {
138  // mocked context that returns a cid-path containing a baseclass.
139  $context = $this->createMock(ilCtrlContextInterface::class);
140  $context
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  }
$context
Definition: webdav.php:31
Class ilCtrlSingleClassPath.
$path
Definition: ltiservices.php:29
getPath(?string $cid_path=null)
+ Here is the call graph for this function:

◆ testSinglePathWithContextBaseClass()

ilCtrlSingleClassPathTest::testSinglePathWithContextBaseClass ( )

Definition at line 67 of file ilCtrlSingleClassPathTest.php.

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

67  : void
68  {
69  // mocked context that returns a cid-path containing a baseclass.
70  $context = $this->createMock(ilCtrlContextInterface::class);
71  $context
72  ->method('getPath')
73  ->willReturn($this->getPath('0:4'))
74  ;
75 
77  $this->structure,
78  $context,
79  ilCtrlCommandClass1TestGUI::class
80  );
81 
82  $this->assertEquals('0:2', $path->getCidPath());
83  }
$context
Definition: webdav.php:31
Class ilCtrlSingleClassPath.
$path
Definition: ltiservices.php:29
getPath(?string $cid_path=null)
+ Here is the call graph for this function:

◆ testSinglePathWithEmptyTargetClassString()

ilCtrlSingleClassPathTest::testSinglePathWithEmptyTargetClassString ( )

Definition at line 122 of file ilCtrlSingleClassPathTest.php.

References $path.

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  }
Class ilCtrlSingleClassPath.
$path
Definition: ltiservices.php:29

◆ testSinglePathWithoutBaseClass()

ilCtrlSingleClassPathTest::testSinglePathWithoutBaseClass ( )

Definition at line 45 of file ilCtrlSingleClassPathTest.php.

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

45  : void
46  {
47  // mocked context that returns no cid-path.
48  $context = $this->createMock(ilCtrlContextInterface::class);
49  $context
50  ->method('getPath')
51  ->willReturn($this->getPath(null))
52  ;
53 
54  $target_class = ilCtrlCommandClass1TestGUI::class;
56  $this->structure,
57  $context,
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  }
$context
Definition: webdav.php:31
Class ilCtrlSingleClassPath.
$path
Definition: ltiservices.php:29
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
getPath(?string $cid_path=null)
+ Here is the call graph for this function:

◆ testSinglePathWithProvidedBaseClass()

ilCtrlSingleClassPathTest::testSinglePathWithProvidedBaseClass ( )

Definition at line 85 of file ilCtrlSingleClassPathTest.php.

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

85  : void
86  {
87  // mocked context that returns no cid-path
88  $context = $this->createMock(ilCtrlContextInterface::class);
89  $context
90  ->method('getPath')
91  ->willReturn($this->getPath(null))
92  ;
93 
95  $this->structure,
96  $context,
97  ilCtrlBaseClass1TestGUI::class
98  );
99 
100  $this->assertEquals('0', $path->getCidPath());
101  }
$context
Definition: webdav.php:31
Class ilCtrlSingleClassPath.
$path
Definition: ltiservices.php:29
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
getPath(?string $cid_path=null)
+ Here is the call graph for this function:

◆ testSinglePathWithSameTargetClass()

ilCtrlSingleClassPathTest::testSinglePathWithSameTargetClass ( )

Definition at line 103 of file ilCtrlSingleClassPathTest.php.

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

103  : void
104  {
105  // mocked context that returns a cid-path that already
106  // contains the target class.
107  $context = $this->createMock(ilCtrlContextInterface::class);
108  $context
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  }
$context
Definition: webdav.php:31
Class ilCtrlSingleClassPath.
$path
Definition: ltiservices.php:29
getPath(?string $cid_path=null)
+ Here is the call graph for this function:

◆ testSinglePathWithUnknownClass()

ilCtrlSingleClassPathTest::testSinglePathWithUnknownClass ( )

Definition at line 30 of file ilCtrlSingleClassPathTest.php.

References $path.

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  }
Class ilCtrlSingleClassPath.
$path
Definition: ltiservices.php:29

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