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