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