Class ilTermsOfServiceDocumentCriterionAssignmentConstraintTest.
More...
|
| criteriaAssignmentProvider () |
|
| testConstraintAcceptanceWorksAsExpected (ilTermsOfServiceDocumentCriterionAssignment $criterionAssignment1, ilTermsOfServiceDocumentCriterionAssignment $criterionAssignment2, ilTermsOfServiceDocumentCriterionAssignment $criterionAssignment3, ilTermsOfServiceDocumentCriterionAssignment $criterionAssignment4) |
| criteriaAssignmentProvider More...
|
|
| testConstraintCheckWorksAsExpected (ilTermsOfServiceDocumentCriterionAssignment $criterionAssignment1, ilTermsOfServiceDocumentCriterionAssignment $criterionAssignment2, ilTermsOfServiceDocumentCriterionAssignment $criterionAssignment3, ilTermsOfServiceDocumentCriterionAssignment $criterionAssignment4) |
| criteriaAssignmentProvider More...
|
|
| testConstraintProblemDetectionWorksAsExpected (ilTermsOfServiceDocumentCriterionAssignment $criterionAssignment1, ilTermsOfServiceDocumentCriterionAssignment $criterionAssignment2, ilTermsOfServiceDocumentCriterionAssignment $criterionAssignment3, ilTermsOfServiceDocumentCriterionAssignment $criterionAssignment4) |
| criteriaAssignmentProvider More...
|
|
| testConstraintRestrictionWorksAsExpected (ilTermsOfServiceDocumentCriterionAssignment $criterionAssignment1, ilTermsOfServiceDocumentCriterionAssignment $criterionAssignment2, ilTermsOfServiceDocumentCriterionAssignment $criterionAssignment3, ilTermsOfServiceDocumentCriterionAssignment $criterionAssignment4) |
| criteriaAssignmentProvider More...
|
|
| testConstraintProblemBuilderWorksAsExpected (ilTermsOfServiceDocumentCriterionAssignment $criterionAssignment1, ilTermsOfServiceDocumentCriterionAssignment $criterionAssignment2, ilTermsOfServiceDocumentCriterionAssignment $criterionAssignment3, ilTermsOfServiceDocumentCriterionAssignment $criterionAssignment4) |
| criteriaAssignmentProvider More...
|
|
| testConstraintExposesCorrectErrorMessagesAfterMultiAccept (ilTermsOfServiceDocumentCriterionAssignment $criterionAssignment1, ilTermsOfServiceDocumentCriterionAssignment $criterionAssignment2, ilTermsOfServiceDocumentCriterionAssignment $criterionAssignment3, ilTermsOfServiceDocumentCriterionAssignment $criterionAssignment4) |
| criteriaAssignmentProvider More...
|
|
| testCriterionWithSameNatureIsNotAcceptedWhenAlreadyAssigned (ilTermsOfServiceDocumentCriterionAssignment $criterionAssignment1, ilTermsOfServiceDocumentCriterionAssignment $criterionAssignment2, ilTermsOfServiceDocumentCriterionAssignment $criterionAssignment3, ilTermsOfServiceDocumentCriterionAssignment $criterionAssignment4) |
| criteriaAssignmentProvider More...
|
|
◆ criteriaAssignmentProvider()
ilTermsOfServiceDocumentCriterionAssignmentConstraintTest::criteriaAssignmentProvider |
( |
| ) |
|
- Returns
- array
- Exceptions
-
Definition at line 79 of file ilTermsOfServiceDocumentCriterionAssignmentConstraintTest.php.
References ilTermsOfServiceBaseTest\getCriterionConfig().
81 $criterionAssignment1 = $this
82 ->getMockBuilder(ilTermsOfServiceDocumentCriterionAssignment::class)
83 ->disableOriginalConstructor()
84 ->setMethods([
'getId',
'getCriterionValue',
'getCriterionId'])
88 ->expects($this->any())
93 ->expects($this->any())
94 ->method(
'getCriterionId')
95 ->willReturn(
'usr_global_role');
98 ->expects($this->any())
99 ->method(
'getCriterionValue')
102 $criterionAssignment2 = $this
103 ->getMockBuilder(ilTermsOfServiceDocumentCriterionAssignment::class)
104 ->disableOriginalConstructor()
105 ->setMethods([
'getId',
'getCriterionValue',
'getCriterionId'])
108 $criterionAssignment2
109 ->expects($this->any())
113 $criterionAssignment2
114 ->expects($this->any())
115 ->method(
'getCriterionId')
116 ->willReturn(
'usr_language');
118 $criterionAssignment2
119 ->expects($this->any())
120 ->method(
'getCriterionValue')
123 $criterionAssignment3 = $this
124 ->getMockBuilder(ilTermsOfServiceDocumentCriterionAssignment::class)
125 ->setMethods([
'getId',
'getCriterionValue',
'getCriterionId'])
126 ->disableOriginalConstructor()
129 $criterionAssignment3
130 ->expects($this->any())
134 $criterionAssignment3
135 ->expects($this->any())
136 ->method(
'getCriterionId')
137 ->willReturn(
'usr_language');
139 $criterionAssignment3
140 ->expects($this->any())
141 ->method(
'getCriterionValue')
144 $criterionAssignment4 = $this
145 ->getMockBuilder(ilTermsOfServiceDocumentCriterionAssignment::class)
146 ->disableOriginalConstructor()
147 ->setMethods([
'getId',
'getCriterionValue',
'getCriterionId'])
150 $criterionAssignment4
151 ->expects($this->any())
155 $criterionAssignment4
156 ->expects($this->any())
157 ->method(
'getCriterionId')
158 ->willReturn(
'usr_global_role');
160 $criterionAssignment4
161 ->expects($this->any())
162 ->method(
'getCriterionValue')
166 [$criterionAssignment1, $criterionAssignment2, $criterionAssignment3, $criterionAssignment4]
getCriterionConfig($value=null)
◆ getCriterionTypeFactoryMock()
ilTermsOfServiceDocumentCriterionAssignmentConstraintTest::getCriterionTypeFactoryMock |
( |
| ) |
|
|
protected |
◆ getCriterionTypeMock()
ilTermsOfServiceDocumentCriterionAssignmentConstraintTest::getCriterionTypeMock |
( |
string |
$typeIdent | ) |
|
|
protected |
◆ getTypeMockForConstraint()
ilTermsOfServiceDocumentCriterionAssignmentConstraintTest::getTypeMockForConstraint |
( |
| ) |
|
|
protected |
◆ testConstraintAcceptanceWorksAsExpected()
criteriaAssignmentProvider
- Parameters
-
- Exceptions
-
Definition at line 178 of file ilTermsOfServiceDocumentCriterionAssignmentConstraintTest.php.
References ilTermsOfServiceBaseTest\getLanguageMock(), and getTypeMockForConstraint().
185 ->getMockBuilder(ilTermsOfServiceDocument::class)
186 ->disableOriginalConstructor()
187 ->setMethods([
'criteria'])
191 ->expects($this->any())
193 ->willReturn([$criterionAssignment1, $criterionAssignment2]);
202 $this->assertTrue($constraint->accepts($criterionAssignment1));
203 $this->assertTrue($constraint->accepts($criterionAssignment2));
204 $this->assertFalse($constraint->accepts($criterionAssignment3));
205 $this->assertTrue($constraint->accepts($criterionAssignment4));
getTypeMockForConstraint()
Class ilTermsOfServiceDocumentCriterionAssignmentConstraint.
◆ testConstraintCheckWorksAsExpected()
criteriaAssignmentProvider
- Parameters
-
- Exceptions
-
Definition at line 216 of file ilTermsOfServiceDocumentCriterionAssignmentConstraintTest.php.
References Vendor\Package\$e, ilTermsOfServiceBaseTest\getLanguageMock(), and getTypeMockForConstraint().
223 ->getMockBuilder(ilTermsOfServiceDocument::class)
224 ->disableOriginalConstructor()
225 ->setMethods([
'criteria'])
229 ->expects($this->any())
231 ->willReturn([$criterionAssignment1, $criterionAssignment2]);
243 $constraint->check($criterionAssignment4);
248 $this->assertFalse($raised);
251 $constraint->check($criterionAssignment3);
254 $this->assertEquals(
'The passed assignment must be unique for the document!', $e->getMessage());
258 $this->assertTrue($raised);
getTypeMockForConstraint()
Class ilTermsOfServiceDocumentCriterionAssignmentConstraint.
◆ testConstraintExposesCorrectErrorMessagesAfterMultiAccept()
criteriaAssignmentProvider
- Parameters
-
- Exceptions
-
Definition at line 393 of file ilTermsOfServiceDocumentCriterionAssignmentConstraintTest.php.
References ilTermsOfServiceBaseTest\getLanguageMock(), and getTypeMockForConstraint().
400 ->getMockBuilder(ilTermsOfServiceDocument::class)
401 ->disableOriginalConstructor()
402 ->setMethods([
'criteria'])
406 ->expects($this->any())
408 ->willReturn([$criterionAssignment1, $criterionAssignment2]);
417 $criterionAssignment5 = clone $criterionAssignment3;
419 $constraint->accepts($criterionAssignment1);
420 $constraint->accepts($criterionAssignment2);
421 $constraint->accepts($criterionAssignment3);
422 $constraint->accepts($criterionAssignment4);
423 $constraint->accepts($criterionAssignment5);
426 'The passed assignment must be unique for the document!',
427 $constraint->problemWith($criterionAssignment3)
430 'The passed assignment must be unique for the document!',
431 $constraint->problemWith($criterionAssignment5)
getTypeMockForConstraint()
Class ilTermsOfServiceDocumentCriterionAssignmentConstraint.
◆ testConstraintProblemBuilderWorksAsExpected()
criteriaAssignmentProvider
- Parameters
-
- Exceptions
-
Definition at line 355 of file ilTermsOfServiceDocumentCriterionAssignmentConstraintTest.php.
References ilTermsOfServiceBaseTest\getLanguageMock(), and getTypeMockForConstraint().
362 ->getMockBuilder(ilTermsOfServiceDocument::class)
363 ->disableOriginalConstructor()
364 ->setMethods([
'criteria'])
368 ->expects($this->any())
370 ->willReturn([$criterionAssignment1, $criterionAssignment2]);
379 $newConstraint = $constraint->withProblemBuilder(
function () {
382 $this->assertEquals(
'phpunit', $newConstraint->problemWith($criterionAssignment3));
getTypeMockForConstraint()
Class ilTermsOfServiceDocumentCriterionAssignmentConstraint.
◆ testConstraintProblemDetectionWorksAsExpected()
criteriaAssignmentProvider
- Parameters
-
- Exceptions
-
Definition at line 269 of file ilTermsOfServiceDocumentCriterionAssignmentConstraintTest.php.
References ilTermsOfServiceBaseTest\getLanguageMock(), and getTypeMockForConstraint().
276 ->getMockBuilder(ilTermsOfServiceDocument::class)
277 ->disableOriginalConstructor()
278 ->setMethods([
'criteria'])
282 ->expects($this->any())
284 ->willReturn([$criterionAssignment1, $criterionAssignment2]);
293 $this->assertNull($constraint->problemWith($criterionAssignment1));
294 $this->assertNull($constraint->problemWith($criterionAssignment2));
295 $this->assertNull($constraint->problemWith($criterionAssignment4));
296 $this->assertIsString($constraint->problemWith($criterionAssignment3));
getTypeMockForConstraint()
Class ilTermsOfServiceDocumentCriterionAssignmentConstraint.
◆ testConstraintRestrictionWorksAsExpected()
criteriaAssignmentProvider
- Parameters
-
- Exceptions
-
Definition at line 307 of file ilTermsOfServiceDocumentCriterionAssignmentConstraintTest.php.
References $ok, $result, ilTermsOfServiceBaseTest\getLanguageMock(), and getTypeMockForConstraint().
314 ->getMockBuilder(ilTermsOfServiceDocument::class)
315 ->disableOriginalConstructor()
316 ->setMethods([
'criteria'])
320 ->expects($this->any())
322 ->willReturn([$criterionAssignment1, $criterionAssignment2]);
333 $ok = $dataFavtgory->ok($criterionAssignment1);
334 $ok2 = $dataFavtgory->ok($criterionAssignment3);
335 $error = $dataFavtgory->error(
'An error occurred');
338 $this->assertTrue(
$result->isOk());
340 $result = $constraint->applyTo($ok2);
341 $this->assertTrue($result->isError());
343 $result = $constraint->applyTo($error);
344 $this->assertSame($error, $result);
getTypeMockForConstraint()
Class ilTermsOfServiceDocumentCriterionAssignmentConstraint.
◆ testCriterionWithSameNatureIsNotAcceptedWhenAlreadyAssigned()
criteriaAssignmentProvider
- Parameters
-
- Exceptions
-
Definition at line 443 of file ilTermsOfServiceDocumentCriterionAssignmentConstraintTest.php.
References ilTermsOfServiceBaseTest\getCriterionConfig(), getCriterionTypeFactoryMock(), getCriterionTypeMock(), and ilTermsOfServiceBaseTest\getLanguageMock().
450 ->getMockBuilder(ilTermsOfServiceDocument::class)
451 ->disableOriginalConstructor()
452 ->setMethods([
'criteria'])
456 ->expects($this->any())
458 ->willReturn([$criterionAssignment1, $criterionAssignment2]);
466 ->expects($this->any())
467 ->method(
'hasUniqueNature')
471 ->expects($this->any())
472 ->method(
'hasUniqueNature')
475 $criterionTypeFactory
476 ->expects($this->any())
477 ->method(
'findByTypeIdent')
478 ->willReturn($criterionType2);
481 $criterionTypeFactory,
487 $criterionWithSameNature = $this
488 ->getMockBuilder(ilTermsOfServiceDocumentCriterionAssignment::class)
489 ->setMethods([
'getId',
'getCriterionValue',
'getCriterionId'])
490 ->disableOriginalConstructor()
493 $criterionWithSameNature
494 ->expects($this->any())
498 $criterionWithSameNature
499 ->expects($this->any())
500 ->method(
'getCriterionId')
501 ->willReturn(
'usr_language');
503 $criterionWithSameNature
504 ->expects($this->any())
505 ->method(
'getCriterionValue')
508 $this->assertFalse($constraint->accepts($criterionWithSameNature));
getCriterionTypeMock(string $typeIdent)
getCriterionConfig($value=null)
getCriterionTypeFactoryMock()
Class ilTermsOfServiceDocumentCriterionAssignmentConstraint.
The documentation for this class was generated from the following file: