ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
ConditionalInterceptTest.php
Go to the documentation of this file.
1<?php
2
19declare(strict_types=1);
20
22
23use ILIAS\LegalDocuments\test\ContainerMock;
26use PHPUnit\Framework\TestCase;
27
28require_once __DIR__ . '/../ContainerMock.php';
29
30class ConditionalInterceptTest extends TestCase
31{
32 use ContainerMock;
33
34 public function testConstruct(): void
35 {
36 $this->assertInstanceOf(ConditionalIntercept::class, new ConditionalIntercept(
37 $this->fail(...),
38 'foo',
39 $this->mock(Target::class)
40 ));
41 }
42
43 public function testIntercept(): void
44 {
45 $instance = new ConditionalIntercept(
46 fn() => true,
47 'foo',
48 $this->mock(Target::class)
49 );
50
51 $this->assertTrue($instance->intercept());
52 }
53
54 public function testId(): void
55 {
56 $instance = new ConditionalIntercept(
57 $this->fail(...),
58 'foo',
59 $this->mock(Target::class)
60 );
61
62 $this->assertSame('foo', $instance->id());
63 }
64
65 public function testTarget(): void
66 {
67 $target = $this->mock(Target::class);
68 $instance = new ConditionalIntercept(
69 $this->fail(...),
70 'foo',
71 $target
72 );
73
74 $this->assertSame($target, $instance->target());
75 }
76}