ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
ilTermsOfServiceAcceptanceHistoryGUITest.php
Go to the documentation of this file.
1<?php
2/* Copyright (c) 1998-2018 ILIAS open source, Extended GPL, see docs/LICENSE */
3
7
13{
16
18 protected $tos;
19
21 protected $tpl;
22
24 protected $ctrl;
25
27 protected $lng;
28
30 protected $rbacsystem;
31
33 protected $error;
34
36 protected $uiFactory;
37
39 protected $uiRenderer;
40
42 protected $request;
43
46
50 public function setUp()
51 {
52 parent::setUp();
53
54 $this->tos = $this->getMockBuilder(\ilObjTermsOfService::class)->disableOriginalConstructor()->getMock();
55 $this->criterionTypeFactory = $this->getMockBuilder(\ilTermsOfServiceCriterionTypeFactoryInterface::class)->disableOriginalConstructor()->getMock();
56 $this->tpl = $this->getMockBuilder(\ilTemplate::class)->disableOriginalConstructor()->setMethods(['g'])->getMock();
57 $this->ctrl = $this->getMockBuilder(\ilCtrl::class)->disableOriginalConstructor()->getMock();
58 $this->lng = $this->getMockBuilder(\ilLanguage::class)->disableOriginalConstructor()->getMock();
59 $this->rbacsystem = $this->getMockBuilder(\ilRbacSystem::class)->disableOriginalConstructor()->getMock();
60 $this->error = $this->getMockBuilder(\ilErrorHandling::class)->disableOriginalConstructor()->getMock();
61 $this->request = $this->getMockBuilder(ServerRequestInterface::class)->disableOriginalConstructor()->getMock();
62 $this->uiFactory = $this->getMockBuilder(Factory::class)->disableOriginalConstructor()->getMock();
63 $this->uiRenderer = $this->getMockBuilder(Renderer::class)->disableOriginalConstructor()->getMock();
64 $this->tableDataProviderFactory = $this->getMockBuilder(\ilTermsOfServiceTableDataProviderFactory::class)->disableOriginalConstructor()->getMock();
65 }
66
71 {
72 $this->tos
73 ->expects($this->any())
74 ->method('getRefId')
75 ->willReturn(4711);
76
77 $this->ctrl
78 ->expects($this->any())
79 ->method('getCmd')
80 ->willReturnOnConsecutiveCalls(
81 'showAcceptanceHistory'
82 );
83
84 $this->rbacsystem
85 ->expects($this->any())
86 ->method('checkAccess')
87 ->willReturn(false);
88
89 $this->error
90 ->expects($this->any())
91 ->method('raiseError')
92 ->willThrowException(new \ilException('no_permission'));
93
94 $gui = new \ilTermsOfServiceAcceptanceHistoryGUI(
95 $this->tos,
96 $this->criterionTypeFactory,
97 $this->tpl,
98 $this->ctrl,
99 $this->lng,
100 $this->rbacsystem,
101 $this->error,
102 $this->request,
103 $this->uiFactory,
104 $this->uiRenderer,
105 $this->tableDataProviderFactory
106 );
107
108 $this->assertException(\ilException::class);
109
110 $gui->executeCommand();
111 }
112}
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.
testAccessDeniedErrorIsRaisedWhenPermissionsAreMissing()
@expectedException \ilException
Class ilTermsOfServiceBaseTest.
assertException(string $exceptionClass)
This is how the factory for UI elements looks.
Definition: Factory.php:16
An entity that renders components to a string output.
Definition: Renderer.php:15
Representation of an incoming, server-side HTTP request.