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;
24use ILIAS\Refinery\Custom\Group as CustomGroup;
25use ILIAS\Refinery\Custom\Transformation as CustomTransformation;
26use ILIAS\Refinery\Custom\Constraint as CustomConstraint;
27use PHPUnit\Framework\TestCase;
29
30class GroupTest extends TestCase
31{
32 private CustomGroup $group;
33 private DataFactory $dataFactory;
35
36 protected function setUp(): void
37 {
38 $this->dataFactory = new DataFactory();
39 $this->language = $this->getMockBuilder(Language::class)
40 ->disableOriginalConstructor()
41 ->getMock();
42
43 $this->group = new CustomGroup($this->dataFactory, $this->language);
44 }
45
46 public function testCustomConstraint(): void
47 {
48 $instance = $this->group->constraint(static function (): void {
49 }, 'some error');
50 $this->assertInstanceOf(CustomConstraint::class, $instance);
51 }
52
53 public function testCustomTransformation(): void
54 {
55 $instance = $this->group->transformation(static function (): void {
56 });
57 $this->assertInstanceOf(CustomTransformation::class, $instance);
58 }
59}
Builds data types.
Definition: Factory.php:36
Transform values according to custom configuration.