ILIAS  trunk Revision v11.0_alpha-1723-g8e69f309bab
All Data Structures Namespaces Files Functions Variables Enumerations Enumerator Modules Pages
ilCollectionTest.php
Go to the documentation of this file.
1 <?php
2 
19 declare(strict_types=1);
20 
22 
26 
28 {
29  public function testNodeInfoCollection(): void
30  {
31  $node1 = $this->createMock(Handler::class);
32  $node2 = $this->createMock(Handler::class);
33  $node3 = $this->createMock(Handler::class);
34 
35  $collection = new Collection();
36  $collection = $collection->withElement($node1);
37  $collection = $collection->withElement($node2);
38  $collection = $collection->withElement($node3);
39 
40  $collection2 = $collection->removeFirst();
41  $collection3 = $collection2->removeFirst();
42  $collection4 = $collection3->removeFirst();
43 
44  $this->assertEquals($node1, $collection->getFirst());
45  $this->assertEquals($node2, $collection2->getFirst());
46  $this->assertEquals($node3, $collection3->getFirst());
47 
48  $this->assertCount(3, $collection);
49  $this->assertCount(2, $collection2);
50  $this->assertCount(1, $collection3);
51  $this->assertCount(0, $collection4);
52  }
53 }