ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
GroupTest.php
Go to the documentation of this file.
1<?php
2
19declare(strict_types=1);
20
22
23use ILIAS\Data\Factory as DataFactory;
31use ILIAS\Refinery\Logical\Group as LogicalGroup;
32use PHPUnit\Framework\TestCase;
34
35class GroupTest extends TestCase
36{
37 private LogicalGroup $group;
38 private DataFactory $dataFactory;
42
43 protected function setUp(): void
44 {
45 $this->dataFactory = new DataFactory();
46 $this->language = $this->getMockBuilder(Language::class)
47 ->disableOriginalConstructor()
48 ->getMock();
49
50 $this->group = new LogicalGroup($this->dataFactory, $this->language);
51
52 $this->greaterThanConstraint = new GreaterThan(2, $this->dataFactory, $this->language);
53 $this->lessThanConstaint = new LessThan(5, $this->dataFactory, $this->language);
54 }
55
56 public function testLogicalOrGroup(): void
57 {
58 $instance = $this->group->logicalOr([$this->greaterThanConstraint, $this->lessThanConstaint]);
59 $this->assertInstanceOf(LogicalOr::class, $instance);
60 }
61
62 public function testNotGroup(): void
63 {
64 $instance = $this->group->not($this->greaterThanConstraint);
65 $this->assertInstanceOf(Not::class, $instance);
66 }
67
68 public function testParallelGroup(): void
69 {
70 $instance = $this->group->parallel([$this->greaterThanConstraint, $this->lessThanConstaint]);
71 $this->assertInstanceOf(Parallel::class, $instance);
72 }
73
74 public function testSequentialGroup(): void
75 {
76 $instance = $this->group->sequential([$this->greaterThanConstraint, $this->lessThanConstaint]);
77 $this->assertInstanceOf(Sequential::class, $instance);
78 }
79}
Builds data types.
Definition: Factory.php:36
A constraint encodes some resrtictions on values.
Definition: Constraint.php:32