ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
TagAssignmentTest.php
Go to the documentation of this file.
1<?php
2
19declare(strict_types=1);
20
22
23use PHPUnit\Framework\TestCase;
26
27class TagAssignmentTest extends TestCase
28{
29 protected function getPath(string $name): PathInterface
30 {
31 return new class ($name) extends NullPath {
32 public function __construct(protected string $name)
33 {
34 }
35
36 public function toString(): string
37 {
38 return $this->name;
39 }
40 };
41 }
42
43 public function testTag(): void
44 {
45 $tag = new NullTag();
46 $assignment = new TagAssignment($this->getPath('name'), $tag);
47
48 $this->assertSame(
49 $tag,
50 $assignment->tag()
51 );
52 }
53
54 public function testMatchesPath(): void
55 {
56 $first_path = $this->getPath('first path');
57 $second_path = $this->getPath('second path');
58 $assignment = new TagAssignment($first_path, new NullTag());
59
60 $this->assertTrue($assignment->matchesPath($first_path));
61 $this->assertFalse($assignment->matchesPath($second_path));
62 }
63}
__construct()
Constructor setup ILIAS global object @access public.
Definition: class.ilias.php:76