◆ setUp()
TransformationsCustomTest::setUp |
( |
| ) |
|
|
protected |
Definition at line 33 of file TransformationsCustomTest.php.
33 : void
34 {
35 $language = $this->createMock(
ILIAS\Language\Language::class);
36 $this->f = new Refinery(new DataFactory(), $language);
37
38 $this->
custom = $this->f->custom()->transformation(
39 function ($value) {
40 if (!is_string($value)) {
41 throw new InvalidArgumentException("'" . gettype($value) . "' is not a string.");
42 }
43 return $value;
44 }
45 );
46 }
Interface Observer \BackgroundTasks Contains several chained tasks and infos about them.
References ILIAS\UI\examples\Chart\Bar\Horizontal\custom().
◆ tearDown()
TransformationsCustomTest::tearDown |
( |
| ) |
|
|
protected |
◆ testApplyToWithValidValueReturnsAnOkResult()
TransformationsCustomTest::testApplyToWithValidValueReturnsAnOkResult |
( |
| ) |
|
◆ testInvoke()
TransformationsCustomTest::testInvoke |
( |
| ) |
|
Definition at line 91 of file TransformationsCustomTest.php.
91 : void
92 {
93 $custom = $this->f->custom()->transformation(
94 function ($value) {
95 if (!is_string($value)) {
96 throw new InvalidArgumentException("'" . gettype($value) . "' is not a string.");
97 }
98 return $value;
99 }
100 );
101
102 $result =
$custom(self::TEST_STRING);
103 $this->assertEquals(self::TEST_STRING, $result);
104 }
References $custom.
◆ testInvokeFails()
TransformationsCustomTest::testInvokeFails |
( |
| ) |
|
Definition at line 106 of file TransformationsCustomTest.php.
106 : void
107 {
108 $custom = $this->f->custom()->transformation(
109 function ($value) {
110 if (!is_string($value)) {
111 throw new InvalidArgumentException("'" . gettype($value) . "' is not a string.");
112 }
113 return $value;
114 }
115 );
116
117 $raised = false;
118 try {
120 }
catch (InvalidArgumentException
$e) {
121 $this->assertEquals(
"'array' is not a string.",
$e->getMessage());
122 $raised = true;
123 }
124 $this->assertTrue($raised);
125
126 $raised = false;
127 try {
128 $lower_string =
$custom(12345);
129 }
catch (InvalidArgumentException
$e) {
130 $this->assertEquals(
"'integer' is not a string.",
$e->getMessage());
131 $raised = true;
132 }
133 $this->assertTrue($raised);
134
135 $raised = false;
136 try {
137 $std_class = new stdClass();
138 $lower_string =
$custom($std_class);
139 }
catch (InvalidArgumentException
$e) {
140 $this->assertEquals(
"'object' is not a string.",
$e->getMessage());
141 $raised = true;
142 }
143 $this->assertTrue($raised);
144 }
References $custom, and Vendor\Package\$e.
◆ testTransform()
TransformationsCustomTest::testTransform |
( |
| ) |
|
◆ testTransformFails()
TransformationsCustomTest::testTransformFails |
( |
| ) |
|
Definition at line 60 of file TransformationsCustomTest.php.
60 : void
61 {
62 $raised = false;
63 try {
64 $lower_string = $this->
custom->transform([]);
65 }
catch (InvalidArgumentException
$e) {
66 $this->assertEquals(
"'array' is not a string.",
$e->getMessage());
67 $raised = true;
68 }
69 $this->assertTrue($raised);
70
71 $raised = false;
72 try {
73 $lower_string = $this->
custom->transform(12345);
74 }
catch (InvalidArgumentException
$e) {
75 $this->assertEquals(
"'integer' is not a string.",
$e->getMessage());
76 $raised = true;
77 }
78 $this->assertTrue($raised);
79
80 $raised = false;
81 try {
82 $std_class = new stdClass();
83 $lower_string = $this->
custom->transform($std_class);
84 }
catch (InvalidArgumentException
$e) {
85 $this->assertEquals(
"'object' is not a string.",
$e->getMessage());
86 $raised = true;
87 }
88 $this->assertTrue($raised);
89 }
References Vendor\Package\$e, and ILIAS\UI\examples\Chart\Bar\Horizontal\custom().
◆ $custom
◆ $f
Refinery TransformationsCustomTest::$f |
|
private |
◆ TEST_STRING
const TransformationsCustomTest::TEST_STRING = "Test" |
|
private |
The documentation for this class was generated from the following file: