ILIAS  release_7 Revision v7.30-3-g800a261c036
ilTermsOfServiceEvaluationBaseTest.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
4use PHPUnit\Framework\MockObject\MockObject;
5
11{
16 protected function getUserMock() : ilObjUser
17 {
18 $user = $this
19 ->getMockBuilder(ilObjUser::class)
20 ->disableOriginalConstructor()
21 ->onlyMethods(['getLanguage', 'getId', 'getLogin'])
22 ->getMock();
23
24 $user
25 ->expects($this->any())
26 ->method('getId')
27 ->willReturn(-1);
28
29 $user
30 ->expects($this->any())
31 ->method('getLogin')
32 ->willReturn('phpunit');
33
34 return $user;
35 }
36
41 protected function getLogMock() : ilLogger
42 {
43 $log = $this
44 ->getMockBuilder(ilLogger::class)
45 ->disableOriginalConstructor()
46 ->getMock();
47
48 return $log;
49 }
50
56 {
57 $evaluator = $this
58 ->getMockBuilder(ilTermsOfServiceDocumentCriteriaEvaluation::class)
59 ->disableOriginalConstructor()
60 ->getMock();
61
62 return $evaluator;
63 }
64
70 {
71 $criterionTypeFactory = $this
72 ->getMockBuilder(ilTermsOfServiceCriterionTypeFactoryInterface::class)
73 ->getMock();
74
75 return $criterionTypeFactory;
76 }
77
83 protected function getCriterionTypeMock(string $typeIdent) : ilTermsOfServiceCriterionType
84 {
85 $criterionType = $this
86 ->getMockBuilder(ilTermsOfServiceCriterionType::class)
87 ->getMock();
88
89 $criterionType
90 ->expects($this->any())
91 ->method('getTypeIdent')
92 ->willReturn($typeIdent);
93
94 return $criterionType;
95 }
96
102 protected function getCriterionAssignmentMock(
103 ilTermsOfServiceCriterionType $criterionType
105 $criterionAssignment = $this
106 ->getMockBuilder(ilTermsOfServiceEvaluableCriterion::class)
107 ->getMock();
108
109 $criterionAssignment
110 ->expects($this->any())
111 ->method('getCriterionId')
112 ->willReturn($criterionType->getTypeIdent());
113
114 return $criterionAssignment;
115 }
116}
An exception for terminatinating execution or to throw for unit testing.
Component logger with individual log levels by component id.
Class ilTermsOfServiceBaseTest.
Class ilTermsOfServiceEvaluationBaseTest.
getCriterionAssignmentMock(ilTermsOfServiceCriterionType $criterionType)
Interface ilTermsOfServiceCriterionType.
getTypeIdent()
Returns a unique id of the criterion type.
Interface ilTermsOfServiceEvaluableCriterion.
$log
Definition: result.php:15