ILIAS  trunk Revision v11.0_alpha-2638-g80c1d007f79
FactoryTest.php
Go to the documentation of this file.
1 <?php
2 
19 declare(strict_types=1);
20 
21 namespace ILIAS\Tests\Refinery;
22 
24 use ILIAS\Refinery\Container\Group as ContainerGroup;
25 use ILIAS\Refinery\Custom\Group as CustomGroup;
31 use ILIAS\Refinery\In\Group as InGroup;
32 use ILIAS\Refinery\Integer\Group as IntegerGroup;
33 use ILIAS\Refinery\Logical\Group as LogicalGroup;
34 use ILIAS\Refinery\Numeric\Group as NumericGroup;
35 use ILIAS\Refinery\Password\Group as PasswordGroup;
37 use ILIAS\Refinery\To\Group as ToGroup;
38 use ILIAS\Refinery\URI\Group as URIGroup;
41 
42 class 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 }
Interface Observer Contains several chained tasks and infos about them.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...