ILIAS  release_6 Revision v6.24-5-g0c8bfefb3b8
assBaseTestCase.php
Go to the documentation of this file.
1<?php
2/* Copyright (c) 1998-2018 ILIAS open source, Extended GPL, see docs/LICENSE */
3
4use PHPUnit\Framework\TestCase;
5
9abstract class assBaseTestCase extends TestCase
10{
14 protected function setUp() : void
15 {
16 $GLOBALS['DIC'] = new \ILIAS\DI\Container();
17
18 parent::setUp();
19 }
20
25 protected function setGlobalVariable($name, $value)
26 {
27 global $DIC;
28
29 $GLOBALS[$name] = $value;
30
31 unset($DIC[$name]);
33 }
34
38 protected function getGlobalTemplateMock()
39 {
40 return $this->getMockBuilder(\ilTemplate::class)->disableOriginalConstructor()->getMock();
41 }
42
46 protected function getDatabaseMock()
47 {
48 return $this->getMockBuilder(\ilDBInterface::class)->disableOriginalConstructor()->getMock();
49 }
50
54 protected function getIliasMock()
55 {
56 $mock = $this->getMockBuilder(\ILIAS::class)->disableOriginalConstructor()->getMock();
57
58 $account = new stdClass();
59 $account->id = 6;
60 $account->fullname = 'Esther Tester';
61
62 $mock->account = $account;
63
64 return $mock;
65 }
66}
if(!defined('PATH_SEPARATOR')) $GLOBALS['_PEAR_default_error_mode']
Definition: PEAR.php:64
An exception for terminatinating execution or to throw for unit testing.
Class assBaseTestCase.
setGlobalVariable($name, $value)
if($format !==null) $name
Definition: metadata.php:230
$DIC
Definition: xapitoken.php:46