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