ILIAS  release_6 Revision v6.24-5-g0c8bfefb3b8
ilTermsOfServiceAcceptanceHistoryGUITest.php
Go to the documentation of this file.
1<?php declare(strict_types=1);
2/* Copyright (c) 1998-2018 ILIAS open source, Extended GPL, see docs/LICENSE */
3
6use PHPUnit\Framework\MockObject\MockObject;
7use Psr\Http\Message\ServerRequestInterface;
8
14{
17
19 protected $tos;
20
22 protected $tpl;
23
25 protected $ctrl;
26
28 protected $lng;
29
31 protected $rbacsystem;
32
34 protected $error;
35
37 protected $uiFactory;
38
40 protected $uiRenderer;
41
43 protected $request;
44
47
51 public function setUp() : void
52 {
53 parent::setUp();
54
55 $this->tos = $this->getMockBuilder(ilObjTermsOfService::class)->disableOriginalConstructor()->getMock();
56 $this->criterionTypeFactory = $this->getMockBuilder(ilTermsOfServiceCriterionTypeFactoryInterface::class)->disableOriginalConstructor()->getMock();
57 $this->tpl = $this->getMockBuilder(ilGlobalPageTemplate::class)->disableOriginalConstructor()->getMock();
58 $this->ctrl = $this->getMockBuilder(ilCtrl::class)->disableOriginalConstructor()->getMock();
59 $this->lng = $this->getMockBuilder(ilLanguage::class)->disableOriginalConstructor()->getMock();
60 $this->rbacsystem = $this->getMockBuilder(ilRbacSystem::class)->disableOriginalConstructor()->getMock();
61 $this->error = $this->getMockBuilder(ilErrorHandling::class)->disableOriginalConstructor()->getMock();
62 $this->request = $this->getMockBuilder(ServerRequestInterface::class)->disableOriginalConstructor()->getMock();
63 $this->uiFactory = $this->getMockBuilder(Factory::class)->disableOriginalConstructor()->getMock();
64 $this->uiRenderer = $this->getMockBuilder(Renderer::class)->disableOriginalConstructor()->getMock();
65 $this->tableDataProviderFactory = $this->getMockBuilder(ilTermsOfServiceTableDataProviderFactory::class)->disableOriginalConstructor()->getMock();
66 }
67
72 {
73 $this->ctrl
74 ->expects($this->any())
75 ->method('getCmd')
76 ->willReturnOnConsecutiveCalls(
77 'showAcceptanceHistory'
78 );
79
80 $this->rbacsystem
81 ->expects($this->any())
82 ->method('checkAccess')
83 ->willReturn(false);
84
85 $this->error
86 ->expects($this->any())
87 ->method('raiseError')
88 ->willThrowException(new ilException('no_permission'));
89
91 $this->tos,
92 $this->criterionTypeFactory,
93 $this->tpl,
94 $this->ctrl,
95 $this->lng,
96 $this->rbacsystem,
97 $this->error,
98 $this->request,
99 $this->uiFactory,
100 $this->uiRenderer,
101 $this->tableDataProviderFactory
102 );
103
104 $this->expectException(ilException::class);
105
106 $gui->executeCommand();
107 }
108}
An exception for terminatinating execution or to throw for unit testing.
error($a_errmsg)
set error message @access public
Base class for ILIAS Exception handling.
Class ilTermsOfServiceAcceptanceHistoryGUITest.
Class ilTermsOfServiceBaseTest.
This is how the factory for UI elements looks.
Definition: Factory.php:18
An entity that renders components to a string output.
Definition: Renderer.php:15