ILIAS  release_10 Revision v10.1-43-ga1241a92c2f
ilTestBaseTestCase.php
Go to the documentation of this file.
1 <?php
2 
19 declare(strict_types=1);
20 
21 require_once __DIR__ . '/ilTestBaseTestCaseTrait.php';
22 
25 
30 class ilTestBaseTestCase extends TestCase
31 {
33 
34  protected ?Container $dic = null;
35 
39  protected function setUp(): void
40  {
41  global $DIC;
42 
43  $this->dic = is_object($DIC) ? clone $DIC : $DIC;
44 
45  $DIC = $this->getMockBuilder(Container::class)->onlyMethods(['uiService'])->getMock();
46  $DIC->method('uiService')->willReturn($this->createMock(ilUIService::class));
47 
48  $this->addGlobal_ilAccess();
49  $this->addGlobal_tpl();
50  $this->addGlobal_ilDB();
51  $this->addGlobal_ilUser();
52  $this->addGlobal_ilias();
53  $this->addGlobal_ilErr();
54  $this->addGlobal_tree();
55  $this->addGlobal_lng();
56  $this->addGlobal_ilAppEventHandler();
57  $this->addGlobal_objDefinition();
58  $this->addGlobal_refinery();
59  $this->addGlobal_http();
60  $this->addGlobal_fileDelivery();
61  $this->addGlobal_ilComponentFactory();
62  $this->addGlobal_ilComponentRepository();
63  $this->addGlobal_uiFactory();
64  $this->addGlobal_uiRenderer();
65  $this->addGlobal_uiService();
66  $this->addGlobal_static_url();
67  $this->addGlobal_upload();
68  $this->addGlobal_ilCtrl();
69  $this->addGlobal_ilBench();
70  $this->addGlobal_ilSetting();
71  $this->addGlobal_resourceStorage();
72 
73  $this->defineGlobalConstants();
74 
75  parent::setUp();
76  }
77 
78  protected function tearDown(): void
79  {
80  global $DIC;
81 
82  $DIC = $this->dic;
83 
84  parent::tearDown();
85  }
86 
87  public static function callMethod($obj, $name, array $args = [])
88  {
89  return (new ReflectionClass($obj))->getMethod($name)->invokeArgs($obj, $args);
90  }
91 }
Customizing of pimple-DIC for ILIAS.
Definition: Container.php:35
static callMethod($obj, $name, array $args=[])
global $DIC
Definition: shib_login.php:25