ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
ilAttributeTest.php
Go to the documentation of this file.
1<?php
2
19declare(strict_types=1);
20
22
23use ILIAS\Export\ImportHandler\Path\Comparison\Handler as ilFilePathComparisonHandler;
24use ILIAS\Export\ImportHandler\Path\Node\Attribute as ilAttributeFilePathNode;
25use PHPUnit\Framework\TestCase;
26
27class 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}