ILIAS  release_8 Revision v8.24
FactoryTest.php
Go to the documentation of this file.
1<?php
2
3declare(strict_types=1);
4
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;
30use ILIAS\Refinery\In\Group as InGroup;
31use ILIAS\Refinery\Integer\Group as IntegerGroup;
32use ILIAS\Refinery\Logical\Group as LogicalGroup;
33use ILIAS\Refinery\Numeric\Group as NumericGroup;
34use ILIAS\Refinery\Password\Group as PasswordGroup;
35use ILIAS\Refinery\String\Group as StringGroup;
36use ILIAS\Refinery\To\Group as ToGroup;
37use ILIAS\Refinery\URI\Group as URIGroup;
38use ilLanguage;
39
40class FactoryTest extends TestCase
41{
42 private Refinery $basicFactory;
43
44 protected function setUp(): void
45 {
46 $language = $this->getMockBuilder(ilLanguage::class)
47 ->disableOriginalConstructor()
48 ->getMock();
49
50 $this->basicFactory = new Refinery(new DataFactory(), $language);
51 }
52
53 public function testCreateToGroup(): void
54 {
55 $group = $this->basicFactory->to();
56
57 $this->assertInstanceOf(ToGroup::class, $group);
58 }
59
60 public function testCreateInGroup(): void
61 {
62 $group = $this->basicFactory->in();
63
64 $this->assertInstanceOf(InGroup::class, $group);
65 }
66
67 public function testCreateIntegerGroup(): void
68 {
69 $group = $this->basicFactory->int();
70
71 $this->assertInstanceOf(IntegerGroup::class, $group);
72 }
73
74 public function testCreateStringGroup(): void
75 {
76 $group = $this->basicFactory->string();
77
78 $this->assertInstanceOf(StringGroup::class, $group);
79 }
80
81 public function testCreateNumericGroup(): void
82 {
83 $group = $this->basicFactory->numeric();
84
85 $this->assertInstanceOf(NumericGroup::class, $group);
86 }
87
88 public function testCreateLogicalGroup(): void
89 {
90 $group = $this->basicFactory->logical();
91
92 $this->assertInstanceOf(LogicalGroup::class, $group);
93 }
94
95 public function testCreatePasswordGroup(): void
96 {
97 $group = $this->basicFactory->password();
98
99 $this->assertInstanceOf(PasswordGroup::class, $group);
100 }
101
102 public function testCreateCustomGroup(): void
103 {
104 $group = $this->basicFactory->custom();
105
106 $this->assertInstanceOf(CustomGroup::class, $group);
107 }
108
109 public function testCreateContainerGroup(): void
110 {
111 $group = $this->basicFactory->container();
112
113 $this->assertInstanceOf(ContainerGroup::class, $group);
114 }
115
116 public function testCreateDateTimeGroup(): void
117 {
118 $group = $this->basicFactory->dateTime();
119 $this->assertInstanceOf(DateTimeGroup::class, $group);
120 }
121
122 public function testCreateUriGrouo(): void
123 {
124 $group = $this->basicFactory->uri();
125 $this->assertInstanceOf(URIGroup::class, $group);
126 }
127
128 public function testByTryingInGroup(): void
129 {
130 $instance = $this->basicFactory->byTrying([
131 $this->basicFactory->numeric(),
132 $this->basicFactory->string()
133 ]);
134 $this->assertInstanceOf(ByTrying::class, $instance);
135 }
136
137 public function testIdentity(): void
138 {
139 $instance = $this->basicFactory->identity();
140 $this->assertInstanceOf(IdentityTransformation::class, $instance);
141 }
142}
Builds data types.
Definition: Factory.php:21
language handling
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...