Class ilBuddySystemRelationCollectionTest.
More...
◆ provideElements()
ilBuddySystemRelationCollectionTest::provideElements |
( |
| ) |
|
- Returns
- array
Definition at line 169 of file ilBuddySystemRelationCollectionTest.php.
171 $relation_1 = $this->getMockBuilder(
'ilBuddySystemRelation')->disableOriginalConstructor()->getMock();
172 $relation_2 = $this->getMockBuilder(
'ilBuddySystemRelation')->disableOriginalConstructor()->getMock();
173 $relation_3 = $this->getMockBuilder(
'ilBuddySystemRelation')->disableOriginalConstructor()->getMock();
174 $relation_4 = $this->getMockBuilder(
'ilBuddySystemRelation')->disableOriginalConstructor()->getMock();
175 $relation_5 = $this->getMockBuilder(
'ilBuddySystemRelation')->disableOriginalConstructor()->getMock();
178 'indexed' => array(array(0, 1, 2, 3, 4, 5)),
179 'associative' => array(array(
'A' =>
'a',
'B' =>
'b',
'C' =>
'c')),
180 'mixed' => array(array(0,
'A' =>
'a', 1,
'B' =>
'b', 2, 3)),
181 'relations' => array(array($relation_1, $relation_2, $relation_3, $relation_4, $relation_5))
◆ setUp()
ilBuddySystemRelationCollectionTest::setUp |
( |
| ) |
|
◆ testElementsCanBeAddedAndRemoved()
ilBuddySystemRelationCollectionTest::testElementsCanBeAddedAndRemoved |
( |
|
$elements | ) |
|
provideElements
- Parameters
-
Definition at line 48 of file ilBuddySystemRelationCollectionTest.php.
References $data.
51 $this->assertTrue($collection->isEmpty());
53 foreach($elements as $elm)
55 $collection->add($elm);
56 $this->assertTrue($collection->contains($elm));
59 foreach($elements as $elm)
61 $collection->removeElement($elm);
62 $this->assertFalse($collection->contains($elm));
65 $this->assertTrue($collection->isEmpty());
67 foreach($elements as $elm)
69 $collection->add($elm);
70 $this->assertTrue($collection->contains($elm));
73 foreach($elements as $elm)
75 $key = $collection->getKey($elm);
76 $collection->remove($key);
77 $this->assertFalse($collection->contains($elm));
80 $this->assertTrue($collection->isEmpty());
82 foreach($elements as $key => $elm)
84 $collection[$key] = $elm;
85 $this->assertTrue($collection->contains($elm));
88 foreach($elements as $key => $elm)
90 unset($collection[$key]);
91 $this->assertFalse($collection->contains($elm));
94 $this->assertTrue($collection->isEmpty());
98 $data = $collection->toArray();
99 $this->assertSame(5, reset(
$data));
Class ilBuddySystemRelationCollection A collection which contains all entries of a buddy list...
◆ testElementsCanBeFiltered()
ilBuddySystemRelationCollectionTest::testElementsCanBeFiltered |
( |
| ) |
|
Definition at line 155 of file ilBuddySystemRelationCollectionTest.php.
163 $this->assertSame(array(3), $collection->slice(2, 1)->getValues());
Class ilBuddySystemRelationCollection A collection which contains all entries of a buddy list...
◆ testElementsCanBeInitiallyAdded()
ilBuddySystemRelationCollectionTest::testElementsCanBeInitiallyAdded |
( |
|
$elements | ) |
|
provideElements
- Parameters
-
Definition at line 27 of file ilBuddySystemRelationCollectionTest.php.
31 $this->assertFalse($collection->isEmpty());
32 $this->assertSame($elements, $collection->toArray());
33 $this->assertSame(array_values($elements), $collection->getValues());
34 $this->assertSame(array_keys($elements), $collection->getKeys());
36 foreach($elements as $key => $elm)
38 $this->assertArrayHasKey($collection->getKey($elm), $elements);
39 $this->assertTrue(isset($collection[$key]));
40 $this->assertEquals($collection[$key], $elm);
Class ilBuddySystemRelationCollection A collection which contains all entries of a buddy list...
◆ testElementsCanBeSliced()
ilBuddySystemRelationCollectionTest::testElementsCanBeSliced |
( |
| ) |
|
Definition at line 139 of file ilBuddySystemRelationCollectionTest.php.
147 $this->assertCount(2, $collection->filter(
function($elm) {
148 return $elm % 2 === 0;
Class ilBuddySystemRelationCollection A collection which contains all entries of a buddy list...
◆ testIterator()
ilBuddySystemRelationCollectionTest::testIterator |
( |
|
$elements | ) |
|
provideElements
- Parameters
-
Definition at line 106 of file ilBuddySystemRelationCollectionTest.php.
110 foreach($collection->getIterator() as $key => $item)
112 $this->assertSame($elements[$key], $item,
"Item {$key} not match");
115 $this->assertCount($iterations, $elements,
"Number of iterations not match");
Class ilBuddySystemRelationCollection A collection which contains all entries of a buddy list...
◆ testRemovingAnNonExistingElementByKeyRaisesAnException()
ilBuddySystemRelationCollectionTest::testRemovingAnNonExistingElementByKeyRaisesAnException |
( |
| ) |
|
InvalidArgumentException
Definition at line 130 of file ilBuddySystemRelationCollectionTest.php.
133 $collection->remove(
"phpunit");
Class ilBuddySystemRelationCollection A collection which contains all entries of a buddy list...
◆ testRemovingAnNonExistingElementRaisesAnException()
ilBuddySystemRelationCollectionTest::testRemovingAnNonExistingElementRaisesAnException |
( |
| ) |
|
InvalidArgumentException
Definition at line 121 of file ilBuddySystemRelationCollectionTest.php.
124 $collection->removeElement(5);
Class ilBuddySystemRelationCollection A collection which contains all entries of a buddy list...
◆ $backupGlobals
ilBuddySystemRelationCollectionTest::$backupGlobals = false |
|
protected |
The documentation for this class was generated from the following file: