Definition at line 35 of file DObjectTest.php.
◆ fieldNamesProvider()
| static ILIAS\Data\Description\DObjectTest::fieldNamesProvider |
( |
| ) |
|
|
static |
Definition at line 116 of file DObjectTest.php.
116 : array
117 {
118 return [
119 ["someName", true],
120 ["some_name", true],
121 ["some", true],
122 ["some1", true],
123 ["1some", false],
124 ["some one", false]
125 ];
126 }
◆ obviousNoMatchProvider()
| static ILIAS\Data\Description\DObjectTest::obviousNoMatchProvider |
( |
| ) |
|
|
static |
Definition at line 142 of file DObjectTest.php.
142 : array
143 {
144 return [
145 [1], ["1"], [null], [true], [[]]
146 ];
147 }
◆ simpleObjectsProvider()
| static ILIAS\Data\Description\DObjectTest::simpleObjectsProvider |
( |
| ) |
|
|
static |
Definition at line 64 of file DObjectTest.php.
64 : array
65 {
66 $v1 = "value";
67 $o1_a = new class () {
69 {
70 return 42;
71 }
72 };
73 $o1_b = new class () {
74 public $value = 42;
75 };
76 $e1 = new \StdClass();
77 $e1->value = 42;
78
79 $v2 = "some_value";
80 $o2_a = new class () {
81 public function getSomeValue():
int
82 {
83 return 23;
84 }
85 };
86 $o2_b = new class () {
87 public $some_value = 23;
88 };
89 $o2_c = new class () {
90 public $someValue = 23;
91 };
92 $e2 = new \StdClass();
93 $e2->some_value = 23;
94
95
96 return [
97 [$v1, $o1_a, $e1],
98 [$v1, $o1_b, $e1],
99 [$v2, $o2_a, $e2],
100 [$v2, $o2_b, $e2],
101 [$v2, $o2_c, $e2],
102 ];
103 }
References ILIAS\UI\Implementation\Component\Input\getValue().
◆ testAllowedFieldNames()
| ILIAS\Data\Description\DObjectTest::testAllowedFieldNames |
( |
string |
$name, |
|
|
bool |
$is_allowed |
|
) |
| |
Definition at line 106 of file DObjectTest.php.
106 : void
107 {
108 if (!$is_allowed) {
109 $this->expectException(\InvalidArgumentException::class);
110 }
111
112 $field = new Field($name, $this->createMock(Description::class));
113 $this->assertEquals($name, $field->getName());
114 }
◆ testObviouslyNotMatching()
| ILIAS\Data\Description\DObjectTest::testObviouslyNotMatching |
( |
|
$data | ) |
|
Definition at line 129 of file DObjectTest.php.
129 : void
130 {
131 $desc = new DObject(
132 $this->createMock(\
ILIAS\Data\Text\SimpleDocumentMarkdown::class)
133 );
134 $res = $desc->getPrimitiveRepresentation(
$data);
135
136 $this->assertInstanceOf(\Closure::class,
$res);
137 $errors = iterator_to_array(
$res());
138 $this->assertCount(1, $errors);
139 $this->assertTrue(is_string($errors[0]));
140 }
Interface Observer \BackgroundTasks Contains several chained tasks and infos about them.
References $data, and $res.
◆ testSimpleObject()
| ILIAS\Data\Description\DObjectTest::testSimpleObject |
( |
string |
$field, |
|
|
|
$object, |
|
|
|
$expected |
|
) |
| |
Definition at line 38 of file DObjectTest.php.
38 : void
39 {
40 $md = $this->createMock(\
ILIAS\Data\Text\SimpleDocumentMarkdown::class);
41 $desc = new DObject(
42 $md,
43 new Field(
44 $field,
45 new DValue(
46 $this->createMock(\
ILIAS\Data\Text\SimpleDocumentMarkdown::class),
47 ValueType::INT
48 )
49 )
50 );
51
52 $res = $desc->getPrimitiveRepresentation($object);
53
54 if (!is_null($expected)) {
55 $this->assertEquals($expected,
$res);
56 } else {
57 $this->assertInstanceOf(\Closure::class,
$res);
58 $errors = iterator_to_array(
$res());
59 $this->assertCount(1, $errors);
60 $this->assertTrue(is_string($errors[0]));
61 }
62 }
References $res.
The documentation for this class was generated from the following file: