ILIAS  release_7 Revision v7.30-3-g800a261c036
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;
6use PHPUnit\Framework\MockObject\MockObject;
7
11abstract class assBaseTestCase extends TestCase
12{
16 protected function setUp() : void
17 {
18 $GLOBALS['DIC'] = new \ILIAS\DI\Container();
19
20 parent::setUp();
21
22 $this->setGlobalVariable('refinery', $this->createMock(ILIAS\Refinery\Factory::class));
23 }
24
29 protected function setGlobalVariable($name, $value)
30 {
31 global $DIC;
32
33 $GLOBALS[$name] = $value;
34
35 unset($DIC[$name]);
37 }
38
42 protected function getGlobalTemplateMock()
43 {
44 return $this->getMockBuilder(\ilTemplate::class)->disableOriginalConstructor()->getMock();
45 }
46
50 protected function getHttpMock()
51 {
52 return $this->getMockBuilder(HTTPServices::class)->disableOriginalConstructor()->getMock();
53 }
54
58 protected function getDatabaseMock()
59 {
60 return $this->getMockBuilder(\ilDBInterface::class)->disableOriginalConstructor()->getMock();
61 }
62
66 protected function getIliasMock()
67 {
68 $mock = $this->getMockBuilder(\ILIAS::class)->disableOriginalConstructor()->getMock();
69
70 $account = new stdClass();
71 $account->id = 6;
72 $account->fullname = 'Esther Tester';
73
74 $mock->account = $account;
75
76 return $mock;
77 }
78}
if(!defined('PATH_SEPARATOR')) $GLOBALS['_PEAR_default_error_mode']
Definition: PEAR.php:64
An exception for terminatinating execution or to throw for unit testing.
Provides an interface to the ILIAS HTTP services.
Class assBaseTestCase.
setGlobalVariable($name, $value)
global $DIC
Definition: goto.php:24
if($format !==null) $name
Definition: metadata.php:230
Class ChatMainBarProvider \MainMenu\Provider.