ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
ilTermsOfServiceDocumentEvaluationTest Class Reference

Class ilTermsOfServiceAcceptanceEntityTest. More...

+ Inheritance diagram for ilTermsOfServiceDocumentEvaluationTest:
+ Collaboration diagram for ilTermsOfServiceDocumentEvaluationTest:

Public Member Functions

 testAskingEvaluatorForDocumentExistenceIfNoDocumentExistAtAllResultsInANegativeAnswer ()
 
 testExceptionIsRaisedIfADocumentIsRequestedFromEvaluatorAndNoDocumentExistsAtAll ()
 
 testFirstDocumentIsReturnedIfEvaluationOfFirstDocumentSucceeded ()
 
 testDocumentOnArbitraryPositionIsReturnedMatchingFirstDocumentWithASucceededEvaluation ()
 
 testFirstMatchingDocumentIsReturnedIfEvaluationOfMultipleDocumentsSucceeded ()
 

Additional Inherited Members

- Protected Member Functions inherited from ilTermsOfServiceEvaluationBaseTest
 getUserMock ()
 
 getLogMock ()
 
 getEvaluatorMock ()
 
 getCriterionTypeFactoryMock ()
 
 getCriterionTypeMock (string $typeIdent)
 
 getCriterionAssignmentMock (\ilTermsOfServiceCriterionType $criterionType)
 
- Protected Member Functions inherited from ilTermsOfServiceBaseTest
 setUp ()
 
 getLanguageMock ()
 
 setGlobalVariable (string $name, $value)
 
 assertException (string $exceptionClass)
 
 getCriterionConfig ($value=null)
 
- Protected Attributes inherited from ilTermsOfServiceBaseTest
 $dic
 

Detailed Description

Member Function Documentation

◆ testAskingEvaluatorForDocumentExistenceIfNoDocumentExistAtAllResultsInANegativeAnswer()

ilTermsOfServiceDocumentEvaluationTest::testAskingEvaluatorForDocumentExistenceIfNoDocumentExistAtAllResultsInANegativeAnswer ( )

Definition at line 13 of file ilTermsOfServiceDocumentEvaluationTest.php.

References $log, $user, ilTermsOfServiceEvaluationBaseTest\getEvaluatorMock(), ilTermsOfServiceEvaluationBaseTest\getLogMock(), and ilTermsOfServiceEvaluationBaseTest\getUserMock().

14  {
15  $evaluator = $this->getEvaluatorMock();
16  $user = $this->getUserMock();
17  $log = $this->getLogMock();
18 
19  $evaluation = new \ilTermsOfServiceSequentialDocumentEvaluation(
20  $evaluator,
21  $user,
22  $log,
23  []
24  );
25 
26  $this->assertFalse($evaluation->hasDocument());
27  }
$log
Definition: sabredav.php:21
$user
Definition: migrateto20.php:57
+ Here is the call graph for this function:

◆ testDocumentOnArbitraryPositionIsReturnedMatchingFirstDocumentWithASucceededEvaluation()

ilTermsOfServiceDocumentEvaluationTest::testDocumentOnArbitraryPositionIsReturnedMatchingFirstDocumentWithASucceededEvaluation ( )

Definition at line 83 of file ilTermsOfServiceDocumentEvaluationTest.php.

References $log, $user, ilTermsOfServiceEvaluationBaseTest\getEvaluatorMock(), ilTermsOfServiceEvaluationBaseTest\getLogMock(), and ilTermsOfServiceEvaluationBaseTest\getUserMock().

84  {
85  $evaluator = $this->getEvaluatorMock();
86  $user = $this->getUserMock();
87  $log = $this->getLogMock();
88 
89  $doc1 = $this
90  ->getMockBuilder(\ilTermsOfServiceSignableDocument::class)
91  ->getMock();
92 
93  $doc2 = $this
94  ->getMockBuilder(\ilTermsOfServiceSignableDocument::class)
95  ->getMock();
96 
97  $doc3 = $this
98  ->getMockBuilder(\ilTermsOfServiceSignableDocument::class)
99  ->getMock();
100 
101  $evaluator
102  ->expects($this->exactly(3))
103  ->method('evaluate')
104  ->withConsecutive(
105  [$doc1],
106  [$doc2],
107  [$doc3]
108  )
109  ->will($this->returnValueMap([
110  [$doc1, false],
111  [$doc2, true],
112  [$doc3, false]
113  ]));
114 
115  $evaluation = new \ilTermsOfServiceSequentialDocumentEvaluation(
116  $evaluator,
117  $user,
118  $log,
119  [$doc1, $doc2, $doc3]
120  );
121 
122  $this->assertTrue($evaluation->hasDocument());
123  $this->assertEquals($doc2, $evaluation->document());
124  }
$log
Definition: sabredav.php:21
$user
Definition: migrateto20.php:57
+ Here is the call graph for this function:

◆ testExceptionIsRaisedIfADocumentIsRequestedFromEvaluatorAndNoDocumentExistsAtAll()

ilTermsOfServiceDocumentEvaluationTest::testExceptionIsRaisedIfADocumentIsRequestedFromEvaluatorAndNoDocumentExistsAtAll ( )

Definition at line 32 of file ilTermsOfServiceDocumentEvaluationTest.php.

References $log, $user, ilTermsOfServiceBaseTest\assertException(), ilTermsOfServiceEvaluationBaseTest\getEvaluatorMock(), ilTermsOfServiceEvaluationBaseTest\getLogMock(), and ilTermsOfServiceEvaluationBaseTest\getUserMock().

33  {
34  $evaluator = $this->getEvaluatorMock();
35  $user = $this->getUserMock();
36  $log = $this->getLogMock();
37 
38  $evaluation = new \ilTermsOfServiceSequentialDocumentEvaluation(
39  $evaluator,
40  $user,
41  $log,
42  []
43  );
44 
45  $this->assertException(\ilTermsOfServiceNoSignableDocumentFoundException::class);
46 
47  $evaluation->document();
48  }
assertException(string $exceptionClass)
$log
Definition: sabredav.php:21
$user
Definition: migrateto20.php:57
+ Here is the call graph for this function:

◆ testFirstDocumentIsReturnedIfEvaluationOfFirstDocumentSucceeded()

ilTermsOfServiceDocumentEvaluationTest::testFirstDocumentIsReturnedIfEvaluationOfFirstDocumentSucceeded ( )

Definition at line 53 of file ilTermsOfServiceDocumentEvaluationTest.php.

References $log, $user, ilTermsOfServiceEvaluationBaseTest\getEvaluatorMock(), ilTermsOfServiceEvaluationBaseTest\getLogMock(), and ilTermsOfServiceEvaluationBaseTest\getUserMock().

54  {
55  $evaluator = $this->getEvaluatorMock();
56  $user = $this->getUserMock();
57  $log = $this->getLogMock();
58 
59  $doc = $this
60  ->getMockBuilder(\ilTermsOfServiceSignableDocument::class)
61  ->getMock();
62 
63  $evaluator
64  ->expects($this->exactly(1))
65  ->method('evaluate')
66  ->with($doc)
67  ->willReturn(true);
68 
69  $evaluation = new \ilTermsOfServiceSequentialDocumentEvaluation(
70  $evaluator,
71  $user,
72  $log,
73  [$doc]
74  );
75 
76  $this->assertTrue($evaluation->hasDocument());
77  $this->assertEquals($doc, $evaluation->document());
78  }
$log
Definition: sabredav.php:21
$user
Definition: migrateto20.php:57
+ Here is the call graph for this function:

◆ testFirstMatchingDocumentIsReturnedIfEvaluationOfMultipleDocumentsSucceeded()

ilTermsOfServiceDocumentEvaluationTest::testFirstMatchingDocumentIsReturnedIfEvaluationOfMultipleDocumentsSucceeded ( )

Definition at line 129 of file ilTermsOfServiceDocumentEvaluationTest.php.

References $log, $user, ilTermsOfServiceEvaluationBaseTest\getEvaluatorMock(), ilTermsOfServiceEvaluationBaseTest\getLogMock(), and ilTermsOfServiceEvaluationBaseTest\getUserMock().

130  {
131  $evaluator = $this->getEvaluatorMock();
132  $user = $this->getUserMock();
133  $log = $this->getLogMock();
134 
135  $doc1 = $this
136  ->getMockBuilder(\ilTermsOfServiceSignableDocument::class)
137  ->getMock();
138 
139  $doc2 = $this
140  ->getMockBuilder(\ilTermsOfServiceSignableDocument::class)
141  ->getMock();
142 
143  $doc3 = $this
144  ->getMockBuilder(\ilTermsOfServiceSignableDocument::class)
145  ->getMock();
146 
147  $evaluator
148  ->expects($this->exactly(3))
149  ->method('evaluate')
150  ->withConsecutive(
151  [$doc1],
152  [$doc2],
153  [$doc3]
154  )
155  ->will($this->returnValueMap([
156  [$doc1, false],
157  [$doc2, true],
158  [$doc3, true]
159  ]));
160 
161  $evaluation = new \ilTermsOfServiceSequentialDocumentEvaluation(
162  $evaluator,
163  $user,
164  $log,
165  [$doc1, $doc2, $doc3]
166  );
167 
168  $this->assertTrue($evaluation->hasDocument());
169  $this->assertEquals($doc2, $evaluation->document());
170  }
$log
Definition: sabredav.php:21
$user
Definition: migrateto20.php:57
+ Here is the call graph for this function:

The documentation for this class was generated from the following file: