ILIAS  trunk Revision v11.0_alpha-1753-gb21ca8c4367
All Data Structures Namespaces Files Functions Variables Enumerations Enumerator Modules Pages
LazyInterceptTest.php
Go to the documentation of this file.
1 <?php
2 
19 declare(strict_types=1);
20 
22 
28 
29 require_once __DIR__ . '/../ContainerMock.php';
30 
31 class 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 }