ILIAS  release_8 Revision v8.24
PollBlockTest.php
Go to the documentation of this file.
1<?php
2
3declare(strict_types=1);
4
22use PHPUnit\Framework\TestCase;
23
28class PollBlockTest extends TestCase
29{
31
32 protected function setGlobalVariable(string $name, $value): void
33 {
34 global $DIC;
35
36 $GLOBALS[$name] = $value;
37
38 unset($DIC[$name]);
39 $DIC[$name] = static function (\ILIAS\DI\Container $c) use ($value) {
40 return $value;
41 };
42 }
43
44
45 protected function setUp(): void
46 {
47 parent::setUp();
48
50 $GLOBALS['DIC'] = $dic;
51
52 $db = $this->createMock(ilDBInterface::class);
53 $lng = $this->createMock(ilLanguage::class);
54
55 $this->setGlobalVariable(
56 "ilDB",
57 $db
58 );
59 $this->setGlobalVariable(
60 "lng",
61 $lng
62 );
63
64 $this->poll_block = new ilPollBlock();
65 }
66
67 protected function tearDown(): void
68 {
69 }
70
71 public function testSetTitle(): void
72 {
74 $pb->setTitle("A poll block");
75
76 $this->assertEquals(
77 "A poll block",
78 $pb->getTitle()
79 );
80 }
81}
if(!defined('PATH_SEPARATOR')) $GLOBALS['_PEAR_default_error_mode']
Definition: PEAR.php:64
Customizing of pimple-DIC for ILIAS.
Definition: Container.php:32
Test class ilPollBlock.
ilPollBlock $poll_block
setGlobalVariable(string $name, $value)
setTitle(string $a_title)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
$c
Definition: cli.php:38
global $DIC
Definition: feed.php:28
if($format !==null) $name
Definition: metadata.php:247
$dic
Definition: result.php:32
$lng