ILIAS  release_6 Revision v6.24-5-g0c8bfefb3b8
All Data Structures Namespaces Files Functions Variables Modules Pages
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 
5 
11 {
16  protected function getUserMock() : ilObjUser
17  {
18  $user = $this
19  ->getMockBuilder(ilObjUser::class)
20  ->disableOriginalConstructor()
21  ->setMethods(['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 }
Interface ilTermsOfServiceCriterionType.
Interface ilTermsOfServiceEvaluableCriterion.
getCriterionAssignmentMock(ilTermsOfServiceCriterionType $criterionType)
getTypeIdent()
Returns a unique id of the criterion type.
Class ilTermsOfServiceBaseTest.
$log
Definition: result.php:15
Class ilTermsOfServiceEvaluationBaseTest.
Component logger with individual log levels by component id.