ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
FactoryTest.php
Go to the documentation of this file.
1<?php
2
19declare(strict_types=1);
20
21namespace ILIAS\Tests\Refinery;
22
23use ILIAS\Refinery\ByTrying as ByTrying;
24use ILIAS\Refinery\Container\Group as ContainerGroup;
25use ILIAS\Refinery\Custom\Group as CustomGroup;
26use ILIAS\Refinery\DateTime\Group as DateTimeGroup;
27use ILIAS\Refinery\Factory as Refinery;
28use ILIAS\Data\Factory as DataFactory;
31use ILIAS\Refinery\In\Group as InGroup;
32use ILIAS\Refinery\Integer\Group as IntegerGroup;
33use ILIAS\Refinery\Logical\Group as LogicalGroup;
34use ILIAS\Refinery\Numeric\Group as NumericGroup;
35use ILIAS\Refinery\Password\Group as PasswordGroup;
36use ILIAS\Refinery\String\Group as StringGroup;
37use ILIAS\Refinery\To\Group as ToGroup;
38use ILIAS\Refinery\URI\Group as URIGroup;
39use ILIAS\Refinery\Encode\Group as EncodeGroup;
40use PHPUnit\Framework\TestCase;
41
42class FactoryTest extends TestCase
43{
45
46 protected function setUp(): void
47 {
48 $language = $this->getMockBuilder(\ILIAS\Language\Language::class)
49 ->disableOriginalConstructor()
50 ->getMock();
51
52 $this->basicFactory = new Refinery(new DataFactory(), $language);
53 }
54
55 public function testCreateToGroup(): void
56 {
57 $group = $this->basicFactory->to();
58
59 $this->assertInstanceOf(ToGroup::class, $group);
60 }
61
62 public function testCreateInGroup(): void
63 {
64 $group = $this->basicFactory->in();
65
66 $this->assertInstanceOf(InGroup::class, $group);
67 }
68
69 public function testCreateIntegerGroup(): void
70 {
71 $group = $this->basicFactory->int();
72
73 $this->assertInstanceOf(IntegerGroup::class, $group);
74 }
75
76 public function testCreateStringGroup(): void
77 {
78 $group = $this->basicFactory->string();
79
80 $this->assertInstanceOf(StringGroup::class, $group);
81 }
82
83 public function testCreateNumericGroup(): void
84 {
85 $group = $this->basicFactory->numeric();
86
87 $this->assertInstanceOf(NumericGroup::class, $group);
88 }
89
90 public function testCreateLogicalGroup(): void
91 {
92 $group = $this->basicFactory->logical();
93
94 $this->assertInstanceOf(LogicalGroup::class, $group);
95 }
96
97 public function testCreatePasswordGroup(): void
98 {
99 $group = $this->basicFactory->password();
100
101 $this->assertInstanceOf(PasswordGroup::class, $group);
102 }
103
104 public function testCreateCustomGroup(): void
105 {
106 $group = $this->basicFactory->custom();
107
108 $this->assertInstanceOf(CustomGroup::class, $group);
109 }
110
111 public function testCreateContainerGroup(): void
112 {
113 $group = $this->basicFactory->container();
114
115 $this->assertInstanceOf(ContainerGroup::class, $group);
116 }
117
118 public function testCreateDateTimeGroup(): void
119 {
120 $group = $this->basicFactory->dateTime();
121 $this->assertInstanceOf(DateTimeGroup::class, $group);
122 }
123
124 public function testCreateUriGroup(): void
125 {
126 $group = $this->basicFactory->uri();
127 $this->assertInstanceOf(URIGroup::class, $group);
128 }
129
130 public function testCreateEncodeGroup(): void
131 {
132 $this->assertInstanceOf(EncodeGroup::class, $this->basicFactory->encode());
133 }
134
135 public function testByTryingInGroup(): void
136 {
137 $instance = $this->basicFactory->byTrying([
138 $this->basicFactory->numeric(),
139 $this->basicFactory->string()
140 ]);
141 $this->assertInstanceOf(ByTrying::class, $instance);
142 }
143
144 public function testIdentity(): void
145 {
146 $instance = $this->basicFactory->identity();
147 $this->assertInstanceOf(IdentityTransformation::class, $instance);
148 }
149
150 public function testExecutable(): void
151 {
152 $instance = $this->basicFactory->executable();
153 $this->assertInstanceOf(IsExecutableTransformation::class, $instance);
154 }
155}
Builds data types.
Definition: Factory.php:36
Validates that the given string is a valid and executable file path.
Interface Observer \BackgroundTasks Contains several chained tasks and infos about them.