19 declare(strict_types=1);
27 require_once(
"./components/ILIAS/Refinery/tests/TestCase.php");
31 private const ERROR =
'error_expected';
35 protected function setUp(): void
45 'empty string' => [
'',
null],
46 'empty string - one space' => [
' ',
null],
47 'empty string - more spaces' => [
' ',
null],
49 'string' => [
'str', self::ERROR],
51 'negative int' => [-1, -1],
53 'array' => [[], self::ERROR],
54 'bool (false)' => [
false, self::ERROR],
55 'bool (true)' => [
true, self::ERROR]
59 #[DataProvider('NullOrNumericDataProvider')] 62 $transformation = $this->
refinery->byTrying([
63 $this->
refinery->numeric()->isNumeric(),
67 if ($expected === self::ERROR) {
68 $this->expectException(ConstraintViolationException::class);
70 $transformed = $transformation->transform($value);
71 $this->assertEquals($expected, $transformed);
78 'string' => [
'str',
'str'],
80 'empty string' => [
'',
null],
82 'bool (true)' => [
true, self::ERROR],
83 'array' => [[], self::ERROR]
87 #[DataProvider('NullOrNumericOrStringDataProvider')] 90 $transformation = $this->
refinery->byTrying([
92 $this->
refinery->numeric()->isNumeric(),
96 if ($expected === self::ERROR) {
97 $this->expectException(ConstraintViolationException::class);
99 $transformed = $transformation->transform($value);
100 $this->assertEquals($expected, $transformed);
106 'string' => [
'str',
'str'],
108 'empty string' => [
'',
''],
109 'int' => [1, self::ERROR],
110 'array' => [[], self::ERROR]
114 #[DataProvider('StringOrNullDataProvider')] 117 $transformation = $this->
refinery->byTrying([
122 if ($expected === self::ERROR) {
123 $this->expectException(ConstraintViolationException::class);
125 $transformed = $transformation->transform($value);
126 $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...