ILIAS  release_9 Revision v9.13-25-g2c18ec4c24f
InternalTest.php
Go to the documentation of this file.
1 <?php
2 
19 declare(strict_types=1);
20 
22 
31 
32 require_once __DIR__ . '/ContainerMock.php';
33 
34 class InternalTest extends TestCase
35 {
36  use ContainerMock;
37 
38  public function testConstruct(): void
39  {
40  $this->assertInstanceOf(Internal::class, new Internal($this->fail(...), $this->fail(...), []));
41  }
42 
43  public function testAll(): void
44  {
45  $this->assertSame(['a' => 1, 'b' => 2, 'c' => 3], $this->createWithDummy()->all('foo'));
46  }
47 
48  public function testGet(): void
49  {
50  $this->assertSame(2, $this->createWithDummy()->get('foo', 'b'));
51  }
52 
53  private function createWithDummy(): Internal
54  {
55  return new Internal(
56  $this->fail(...),
57  fn() => $this->wiring(),
58  [
59  get_class($this->dummyConsumer())
60  ]
61  );
62  }
63 
64  private function dummyConsumer(): Consumer
65  {
66  return new class () implements Consumer {
67  public function uses(UseSlot $slot, LazyProvide $provide): UseSlot
68  {
69  return $slot;
70  }
71  public function id(): string
72  {
73  return self::class;
74  }
75  };
76  }
77 
78  private function wiring(): Wiring
79  {
80  return new class () extends Wiring {
81  public function __construct()
82  {
83  }
84  public function map(): Map
85  {
86  return new Map(['foo' => ['a' => 1, 'b' => 2, 'c' => 3]]);
87  }
88  };
89  }
90 }
__construct()
Constructor setup ILIAS global object public.
Definition: class.ilias.php:62