ILIAS  trunk Revision v11.0_alpha-1753-gb21ca8c4367
All Data Structures Namespaces Files Functions Variables Enumerations Enumerator Modules Pages
ilIndexTest.php
Go to the documentation of this file.
1 <?php
2 
19 declare(strict_types=1);
20 
22 
23 use ILIAS\Export\ImportHandler\Path\Comparison\Handler as ilFilePathComparisonHandler;
24 use ILIAS\Export\ImportHandler\Path\Node\Index as ilIndexFilePathNode;
26 
27 class ilIndexTest extends TestCase
28 {
29  public function testIndexNode(): void
30  {
31  $comp = $this->createMock(ilFilePathComparisonHandler::class);
32  $comp->expects($this->any())->method('toString')->willReturn('<3');
33 
34  $node = new ilIndexFilePathNode();
35  $node2 = $node->withIndex(20);
36  $node3 = $node2->withComparison($comp);
37  $node4 = $node2->withIndexingFromEndEnabled(true);
38 
39  $this->assertEquals('[0]', $node->toString());
40  $this->assertEquals('[20]', $node2->toString());
41  $this->assertEquals('[position()<3]', $node3->toString());
42  $this->assertEquals('[(last)-20]', $node4->toString());
43 
44  $this->assertFalse($node->requiresPathSeparator());
45  $this->assertFalse($node2->requiresPathSeparator());
46  $this->assertFalse($node3->requiresPathSeparator());
47  $this->assertFalse($node4->requiresPathSeparator());
48  }
49 }