ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
ilTermsOfServiceEvaluationBaseTest.php
Go to the documentation of this file.
1 <?php
2 /* Copyright (c) 1998-2018 ILIAS open source, Extended GPL, see docs/LICENSE */
3 
9 {
13  protected function getUserMock() : \ilObjUser
14  {
15  $user = $this
16  ->getMockBuilder(\ilObjUser::class)
17  ->disableOriginalConstructor()
18  ->setMethods(['getLanguage', 'getId', 'getLogin'])
19  ->getMock();
20 
21  $user
22  ->expects($this->any())
23  ->method('getId')
24  ->willReturn(-1);
25 
26  $user
27  ->expects($this->any())
28  ->method('getLogin')
29  ->willReturn('phpunit');
30 
31  return $user;
32  }
33 
37  protected function getLogMock() : \ilLogger
38  {
39  $log = $this
40  ->getMockBuilder(\ilLogger::class)
41  ->disableOriginalConstructor()
42  ->getMock();
43 
44  return $log;
45  }
46 
51  {
52  $evaluator = $this
53  ->getMockBuilder(\ilTermsOfServiceDocumentCriteriaEvaluation::class)
54  ->disableOriginalConstructor()
55  ->getMock();
56 
57  return $evaluator;
58  }
59 
64  {
65  $criterionTypeFactory = $this
66  ->getMockBuilder(\ilTermsOfServiceCriterionTypeFactoryInterface::class)
67  ->getMock();
68 
69  return $criterionTypeFactory;
70  }
71 
76  protected function getCriterionTypeMock(string $typeIdent) : \ilTermsOfServiceCriterionType
77  {
78  $criterionType = $this
79  ->getMockBuilder(\ilTermsOfServiceCriterionType::class)
80  ->getMock();
81 
82  $criterionType
83  ->expects($this->any())
84  ->method('getTypeIdent')
85  ->willReturn($typeIdent);
86 
87  return $criterionType;
88  }
89 
95  {
96  $criterionAssignment = $this
97  ->getMockBuilder(\ilTermsOfServiceEvaluableCriterion::class)
98  ->getMock();
99 
100  $criterionAssignment
101  ->expects($this->any())
102  ->method('getCriterionId')
103  ->willReturn($criterionType->getTypeIdent());
104 
105  return $criterionAssignment;
106  }
107 }
Interface ilTermsOfServiceCriterionType.
Interface ilTermsOfServiceEvaluableCriterion.
$log
Definition: sabredav.php:21
getTypeIdent()
Returns a unique id of the criterion type.
Class ilTermsOfServiceBaseTest.
$user
Definition: migrateto20.php:57
getCriterionAssignmentMock(\ilTermsOfServiceCriterionType $criterionType)
Class ilTermsOfServiceEvaluationBaseTest.
Component logger with individual log levels by component id.