ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
PollBlockTest.php
Go to the documentation of this file.
1<?php
2
19declare(strict_types=1);
20
21use PHPUnit\Framework\TestCase;
22
27class PollBlockTest 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 $lng = $this->createMock(ilLanguage::class);
53
54 $this->setGlobalVariable(
55 "ilDB",
56 $db
57 );
58 $this->setGlobalVariable(
59 "lng",
60 $lng
61 );
62
63 $this->poll_block = new ilPollBlock();
64 }
65
66 protected function tearDown(): void
67 {
68 }
69
70 public function testSetTitle(): void
71 {
73 $pb->setTitle("A poll block");
74
75 $this->assertEquals(
76 "A poll block",
77 $pb->getTitle()
78 );
79 }
80}
Customizing of pimple-DIC for ILIAS.
Definition: Container.php:36
Test class ilPollBlock.
ilPollBlock $poll_block
setGlobalVariable(string $name, $value)
setTitle(string $a_title)
Custom block for polls.
$c
Definition: deliver.php:25
$dic
Definition: ltiresult.php:33
global $lng
Definition: privfeed.php:31
global $DIC
Definition: shib_login.php:26
$GLOBALS["DIC"]
Definition: wac.php:54