19 declare(strict_types=1);
26 require_once(
"./components/ILIAS/Refinery/tests/TestCase.php");
30 private const ERROR =
'error_expected';
34 protected function setUp(): void
44 'empty string' => [
'',
null],
45 'empty string - one space' => [
' ',
null],
46 'empty string - more spaces' => [
' ',
null],
48 'string' => [
'str', self::ERROR],
50 'negative int' => [-1, -1],
52 'array' => [[], self::ERROR],
53 'bool (false)' => [
false, self::ERROR],
54 'bool (true)' => [
true, self::ERROR]
65 $transformation = $this->
refinery->byTrying([
66 $this->
refinery->numeric()->isNumeric(),
70 if ($expected === self::ERROR) {
71 $this->expectException(ConstraintViolationException::class);
73 $transformed = $transformation->transform($value);
74 $this->assertEquals($expected, $transformed);
81 'string' => [
'str',
'str'],
83 'empty string' => [
'',
null],
85 'bool (true)' => [
true, self::ERROR],
86 'array' => [[], self::ERROR]
97 $transformation = $this->
refinery->byTrying([
99 $this->
refinery->numeric()->isNumeric(),
103 if ($expected === self::ERROR) {
104 $this->expectException(ConstraintViolationException::class);
106 $transformed = $transformation->transform($value);
107 $this->assertEquals($expected, $transformed);
113 'string' => [
'str',
'str'],
115 'empty string' => [
'',
''],
116 'int' => [1, self::ERROR],
117 'array' => [[], self::ERROR]
128 $transformation = $this->
refinery->byTrying([
133 if ($expected === self::ERROR) {
134 $this->expectException(ConstraintViolationException::class);
136 $transformed = $transformation->transform($value);
137 $this->assertEquals($expected, $transformed);
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...