ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
EventItemsTest.php
Go to the documentation of this file.
1<?php
2
19declare(strict_types=1);
20
21use PHPUnit\Framework\TestCase;
22
27class 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
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 {
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.
ilEventItems $event_items
setGlobalVariable(string $name, $value)
Customizing of pimple-DIC for ILIAS.
Definition: Container.php:36
class ilEventItems
setEventId(int $a_event_id)
$c
Definition: deliver.php:25
$dic
Definition: ltiresult.php:33
global $DIC
Definition: shib_login.php:26
$GLOBALS["DIC"]
Definition: wac.php:54