ILIAS  trunk Revision v11.0_alpha-1769-g99a433fe2dc
All Data Structures Namespaces Files Functions Variables Enumerations Enumerator Modules Pages
ilAttributeTest.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\Attribute as ilAttributeFilePathNode;
26 
27 class ilAttributeTest extends TestCase
28 {
29  protected function setUp(): void
30  {
31 
32  }
33 
34  public function testAttributeTest(): void
35  {
36  $comp = $this->createMock(ilFilePathComparisonHandler::class);
37  $comp->expects($this->any())->method('toString')->willReturn('<3');
38 
39  $node = new ilAttributeFilePathNode();
40  $node2 = $node
41  ->withComparison($comp)
42  ->withAttribute('a');
43  $node3 = $node
44  ->withAnyAttributeEnabled(true);
45  $node4 = $node2
46  ->withAnyAttributeEnabled(true);
47  $node5 = $node
48  ->withAttribute('b');
49 
50  $this->assertEquals('[@]', $node->toString());
51  $this->assertEquals('[@a<3]', $node2->toString());
52  $this->assertEquals('[@*]', $node3->toString());
53  $this->assertEquals('[@*]', $node4->toString());
54  $this->assertEquals('[@b]', $node5->toString());
55 
56  $this->assertTrue($node->requiresPathSeparator());
57  $this->assertTrue($node2->requiresPathSeparator());
58  $this->assertTrue($node3->requiresPathSeparator());
59  $this->assertTrue($node4->requiresPathSeparator());
60  $this->assertTrue($node5->requiresPathSeparator());
61  }
62 }