Definition at line 33 of file DMapTest.php.
◆ obviousNoMatchProvider()
| static ILIAS\Data\DMapTest::obviousNoMatchProvider |
( |
| ) |
|
|
static |
Definition at line 61 of file DMapTest.php.
61 : array
62 {
63 return [
64 [1], ["1"], [null], [true], [new \StdClass()], [new \DateTimeImmutable()]
65 ];
66 }
◆ setUp()
| ILIAS\Data\DMapTest::setUp |
( |
| ) |
|
Definition at line 39 of file DMapTest.php.
39 : void
40 {
41 $this->k = $this->createMock(DValue::class);
42 $this->v = $this->createMock(Description::class);
43 $this->m = new DMap(
44 $this->createMock(\
ILIAS\Data\Text\SimpleDocumentMarkdown::class),
45 $this->k,
46 $this->v
47 );
48 }
Interface Observer \BackgroundTasks Contains several chained tasks and infos about them.
◆ testEmptyMatches()
| ILIAS\Data\DMapTest::testEmptyMatches |
( |
| ) |
|
Definition at line 68 of file DMapTest.php.
68 : void
69 {
70 $res = $this->m->getPrimitiveRepresentation([]);
71
72 $this->assertEquals([],
$res);
73 }
References $res.
◆ testFailsOnKeyFailure()
| ILIAS\Data\DMapTest::testFailsOnKeyFailure |
( |
| ) |
|
Definition at line 110 of file DMapTest.php.
110 : void
111 {
113
114 $this->v
115 ->method("getPrimitiveRepresentation")
116 ->willReturn(1);
117
118 $this->k
119 ->method("getPrimitiveRepresentation")
120 ->willReturn(fn() => yield "FAILURE");
121
122 $res = $this->m->getPrimitiveRepresentation(
$data);
123
124 $this->assertInstanceOf(\Closure::class,
$res);
125 $errors = iterator_to_array(
$res());
126 $this->assertCount(1, $errors);
127 $this->assertTrue(is_string($errors[0]));
128 $this->assertTrue(str_contains($errors[0], "FAILURE"));
129 }
References $data, and $res.
◆ testFailsOnValueFailure()
| ILIAS\Data\DMapTest::testFailsOnValueFailure |
( |
| ) |
|
Definition at line 131 of file DMapTest.php.
131 : void
132 {
134
135 $this->v
136 ->method("getPrimitiveRepresentation")
137 ->willReturn(fn() => yield "FAILURE");
138
139 $this->k
140 ->method("getPrimitiveRepresentation")
141 ->willReturn("a");
142
143 $res = $this->m->getPrimitiveRepresentation(
$data);
144
145 $this->assertInstanceOf(\Closure::class,
$res);
146 $errors = iterator_to_array(
$res());
147 $this->assertCount(1, $errors);
148 $this->assertTrue(is_string($errors[0]));
149 $this->assertTrue(str_contains($errors[0], "FAILURE"));
150 }
References $data, and $res.
◆ testForwardsToSubDescriptions()
| ILIAS\Data\DMapTest::testForwardsToSubDescriptions |
( |
| ) |
|
Definition at line 75 of file DMapTest.php.
75 : void
76 {
78 "a" => 1,
79 "b" => 2
80 ];
81
82 $keys = ["c", "d"];
83 $this->k->expects($this->exactly(2))
84 ->method("getPrimitiveRepresentation")
85 ->willReturnCallback(
function (
$v) use (&$keys) {
86 array_push($keys,
$v);
87 return array_shift($keys);
88 });
89
90 $values = [3, 4];
91 $this->v->expects($this->exactly(2))
92 ->method("getPrimitiveRepresentation")
93 ->willReturnCallback(
function (
$v) use (&$values) {
94 array_push($values,
$v);
95 return array_shift($values);
96 });
97
98 $expected = [
99 "c" => 3,
100 "d" => 4
101 ];
102
103 $res = $this->m->getPrimitiveRepresentation(
$data);
104
105 $this->assertEquals($expected,
$res);
106 $this->assertEquals(["a", "b"], $keys);
107 $this->assertEquals([1, 2], $values);
108 }
References $data, $res, and ILIAS\Data\DMapTest\$v.
◆ testObviouslyNotMatching()
| ILIAS\Data\DMapTest::testObviouslyNotMatching |
( |
|
$data | ) |
|
Definition at line 51 of file DMapTest.php.
51 : void
52 {
53 $res = $this->m->getPrimitiveRepresentation(
$data);
54
55 $this->assertInstanceOf(\Closure::class,
$res);
56 $errors = iterator_to_array(
$res());
57 $this->assertCount(1, $errors);
58 $this->assertTrue(is_string($errors[0]));
59 }
References $data, and $res.
◆ $k
| DValue ILIAS\Data\DMapTest::$k |
|
protected |
◆ $m
| DMap ILIAS\Data\DMapTest::$m |
|
protected |
◆ $v
The documentation for this class was generated from the following file: