ILIAS  trunk Revision v11.0_alpha-1723-g8e69f309bab
All Data Structures Namespaces Files Functions Variables Enumerations Enumerator Modules Pages
EventItemsTest.php
Go to the documentation of this file.
1 <?php
2 
19 declare(strict_types=1);
20 
22 
27 class EventItemsTest extends TestCase
28 {
30 
31  protected function setGlobalVariable(string $name, $value): void
32  {
33  global $DIC;
34 
35  $GLOBALS[$name] = $value;
36 
37  unset($DIC[$name]);
38  $DIC[$name] = static function (\ILIAS\DI\Container $c) use ($value) {
39  return $value;
40  };
41  }
42 
43 
44  protected function setUp(): void
45  {
46  parent::setUp();
47 
48  $dic = new ILIAS\DI\Container();
49  $GLOBALS['DIC'] = $dic;
50 
51  $db = $this->createMock(ilDBInterface::class);
52  $tree = $this->createMock(ilTree::class);
53 
54  $this->setGlobalVariable(
55  "ilDB",
56  $db
57  );
58  $this->setGlobalVariable(
59  "tree",
60  $tree
61  );
62 
63  $this->event_items = new ilEventItems(4);
64  }
65 
66  protected function tearDown(): void
67  {
68  }
69 
70  public function testSetEventId(): void
71  {
72  $ei = $this->event_items;
73  $ei->setEventId(7);
74 
75  $this->assertNotEquals(
76  4,
77  $ei->getEventId()
78  );
79  $this->assertEquals(
80  7,
81  $ei->getEventId()
82  );
83  }
84 }
Test class ilEventItems.
setEventId(int $a_event_id)
$c
Definition: deliver.php:25
ilEventItems $event_items
Customizing of pimple-DIC for ILIAS.
Definition: Container.php:35
$GLOBALS["DIC"]
Definition: wac.php:53
global $DIC
Definition: shib_login.php:22
setGlobalVariable(string $name, $value)
$dic
Definition: result.php:31
class ilEventItems