Definition at line 29 of file ByTryingTransformTest.php.
◆ NullOrNumericDataProvider()
static ByTryingTransformTest::NullOrNumericDataProvider |
( |
| ) |
|
|
static |
Definition at line 42 of file ByTryingTransformTest.php.
42 : array
43 {
44 return [
45 'empty string' => ['', null],
46 'empty string - one space' => [' ', null],
47 'empty string - more spaces' => [' ', null],
48 'null' => [null, null],
50 'int' => [1, 1],
51 'negative int' => [-1, -1],
52 'zero' => [0, 0],
56 ];
57 }
References ERROR.
◆ NullOrNumericOrStringDataProvider()
static ByTryingTransformTest::NullOrNumericOrStringDataProvider |
( |
| ) |
|
|
static |
Definition at line 75 of file ByTryingTransformTest.php.
75 : array
76 {
77 return [
78 'string' => ['str', 'str'],
79 'null' => [null, null],
80 'empty string' => ['', null],
81 'int' => [1, 1],
84 ];
85 }
References ERROR.
◆ setUp()
ByTryingTransformTest::setUp |
( |
| ) |
|
|
protected |
◆ StringOrNullDataProvider()
static ByTryingTransformTest::StringOrNullDataProvider |
( |
| ) |
|
|
static |
Definition at line 103 of file ByTryingTransformTest.php.
103 : array
104 {
105 return [
106 'string' => ['str', 'str'],
107 'null' => [null, null],
108 'empty string' => ['', ''],
111 ];
112 }
References ERROR.
◆ testNullOrNumeric()
ByTryingTransformTest::testNullOrNumeric |
( |
mixed |
$value, |
|
|
mixed |
$expected |
|
) |
| |
Definition at line 60 of file ByTryingTransformTest.php.
60 : void
61 {
62 $transformation = $this->
refinery->byTrying([
63 $this->
refinery->numeric()->isNumeric(),
64 $this->refinery->kindlyTo()->null()
65 ]);
66
67 if ($expected === self::ERROR) {
68 $this->expectException(ConstraintViolationException::class);
69 }
70 $transformed = $transformation->transform($value);
71 $this->assertEquals($expected, $transformed);
72 }
References ILIAS\Repository\refinery().
◆ testNullOrNumericOrString()
ByTryingTransformTest::testNullOrNumericOrString |
( |
mixed |
$value, |
|
|
mixed |
$expected |
|
) |
| |
Definition at line 88 of file ByTryingTransformTest.php.
88 : void
89 {
90 $transformation = $this->
refinery->byTrying([
92 $this->refinery->numeric()->isNumeric(),
93 $this->refinery->to()->string()
94 ]);
95
96 if ($expected === self::ERROR) {
97 $this->expectException(ConstraintViolationException::class);
98 }
99 $transformed = $transformation->transform($value);
100 $this->assertEquals($expected, $transformed);
101 }
References ILIAS\Repository\refinery().
◆ testStringOrNull()
ByTryingTransformTest::testStringOrNull |
( |
mixed |
$value, |
|
|
mixed |
$expected |
|
) |
| |
Definition at line 115 of file ByTryingTransformTest.php.
115 : void
116 {
117 $transformation = $this->
refinery->byTrying([
119 $this->refinery->kindlyTo()->null()
120 ]);
121
122 if ($expected === self::ERROR) {
123 $this->expectException(ConstraintViolationException::class);
124 }
125 $transformed = $transformation->transform($value);
126 $this->assertEquals($expected, $transformed);
127 }
References ILIAS\Repository\refinery().
◆ $refinery
Refinery ByTryingTransformTest::$refinery |
|
private |
◆ ERROR
const ByTryingTransformTest::ERROR = 'error_expected' |
|
private |
The documentation for this class was generated from the following file: