ILIAS  trunk Revision v13.0_alpha-62-g3b72d83f2e5
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;
34use PHPUnit\Framework\MockObject\Stub;
35
36class GroupTest extends TestCase
37{
38 private LogicalGroup $group;
39 private DataFactory $dataFactory;
40 private Language&Stub $language;
43
44 protected function setUp(): void
45 {
46 $this->dataFactory = new DataFactory();
47 $this->language = $this->createStub(Language::class);
48
49 $this->group = new LogicalGroup($this->dataFactory, $this->language);
50
51 $this->greaterThanConstraint = new GreaterThan(2, $this->dataFactory, $this->language);
52 $this->lessThanConstaint = new LessThan(5, $this->dataFactory, $this->language);
53 }
54
55 public function testLogicalOrGroup(): void
56 {
57 $instance = $this->group->logicalOr([$this->greaterThanConstraint, $this->lessThanConstaint]);
58 $this->assertInstanceOf(LogicalOr::class, $instance);
59 }
60
61 public function testNotGroup(): void
62 {
63 $instance = $this->group->not($this->greaterThanConstraint);
64 $this->assertInstanceOf(Not::class, $instance);
65 }
66
67 public function testParallelGroup(): void
68 {
69 $instance = $this->group->parallel([$this->greaterThanConstraint, $this->lessThanConstaint]);
70 $this->assertInstanceOf(Parallel::class, $instance);
71 }
72
73 public function testSequentialGroup(): void
74 {
75 $instance = $this->group->sequential([$this->greaterThanConstraint, $this->lessThanConstaint]);
76 $this->assertInstanceOf(Sequential::class, $instance);
77 }
78}
Builds data types.
Definition: Factory.php:36
A constraint encodes some resrtictions on values.
Definition: Constraint.php:32