◆ provideElements()
static ilBuddySystemRelationCollectionTestCase::provideElements |
( |
| ) |
|
|
static |
- Returns
- array{indexed: int[][], associative: array<int, array{A: string, B: string, C: string}>, mixed: array<int, array<int|string, int|string>>, relations: &[][]}
Definition at line 142 of file ilBuddySystemRelationCollectionTestCase.php.
151 'indexed' => [[0, 1, 2, 3, 4, 5]],
152 'associative' => [[
'A' =>
'a',
'B' =>
'b',
'C' =>
'c']],
153 'mixed' => [[0,
'A' =>
'a', 1,
'B' =>
'b', 2, 3]],
154 'relations' => [[$relation1, $relation2, $relation3, $relation4, $relation5]]
Class ilBuddySystemUnlinkedRelationState.
◆ testElementsCanBeAddedAndRemoved()
ilBuddySystemRelationCollectionTestCase::testElementsCanBeAddedAndRemoved |
( |
array |
$elements | ) |
|
Definition at line 43 of file ilBuddySystemRelationCollectionTestCase.php.
References $data.
46 $this->assertTrue($collection->isEmpty());
48 foreach ($elements as $elm) {
49 $collection->add($elm);
50 $this->assertTrue($collection->contains($elm));
53 foreach ($elements as $elm) {
54 $collection->removeElement($elm);
55 $this->assertFalse($collection->contains($elm));
58 $this->assertTrue($collection->isEmpty());
60 foreach ($elements as $elm) {
61 $collection->add($elm);
62 $this->assertTrue($collection->contains($elm));
65 foreach ($elements as $elm) {
66 $key = $collection->getKey($elm);
67 $collection->remove($key);
68 $this->assertFalse($collection->contains($elm));
71 $this->assertTrue($collection->isEmpty());
73 foreach ($elements as $key => $elm) {
74 $collection[$key] = $elm;
75 $this->assertTrue($collection->contains($elm));
78 foreach ($elements as $key => $elm) {
79 unset($collection[$key]);
80 $this->assertFalse($collection->contains($elm));
83 $this->assertTrue($collection->isEmpty());
87 $data = $collection->toArray();
88 $this->assertSame(5, reset(
$data));
◆ testElementsCanBeFiltered()
ilBuddySystemRelationCollectionTestCase::testElementsCanBeFiltered |
( |
| ) |
|
◆ testElementsCanBeInitiallyAdded()
ilBuddySystemRelationCollectionTestCase::testElementsCanBeInitiallyAdded |
( |
array |
$elements | ) |
|
Definition at line 26 of file ilBuddySystemRelationCollectionTestCase.php.
30 $this->assertFalse($collection->isEmpty());
31 $this->assertSame($elements, $collection->toArray());
32 $this->assertSame(array_values($elements), $collection->getValues());
33 $this->assertSame(array_keys($elements), $collection->getKeys());
35 foreach ($elements as $key => $elm) {
36 $this->assertArrayHasKey($collection->getKey($elm), $elements);
37 $this->assertTrue(isset($collection[$key]));
38 $this->assertEquals($collection[$key], $elm);
◆ testElementsCanBeSliced()
ilBuddySystemRelationCollectionTestCase::testElementsCanBeSliced |
( |
| ) |
|
◆ testIterator()
ilBuddySystemRelationCollectionTestCase::testIterator |
( |
array |
$elements | ) |
|
Definition at line 92 of file ilBuddySystemRelationCollectionTestCase.php.
96 foreach ($collection as $key => $item) {
97 $this->assertSame($elements[$key], $item,
"Item $key not match");
100 $this->assertCount($iterations, $elements,
'Number of iterations not match');
◆ testRemovingAnNonExistingElementByKeyRaisesAnException()
ilBuddySystemRelationCollectionTestCase::testRemovingAnNonExistingElementByKeyRaisesAnException |
( |
| ) |
|
◆ testRemovingAnNonExistingElementRaisesAnException()
ilBuddySystemRelationCollectionTestCase::testRemovingAnNonExistingElementRaisesAnException |
( |
| ) |
|
The documentation for this class was generated from the following file: