ILIAS  trunk Revision v13.0_alpha-62-g3b72d83f2e5
OfComponentTest.php
Go to the documentation of this file.
1<?php
2
19declare(strict_types=1);
20
22
23use PHPUnit\Framework\TestCase;
26
27class OfComponentTest extends TestCase
28{
32 protected \PHPUnit\Framework\MockObject\Stub $component;
34
35 public function setUp(): void
36 {
37 $this->component = $this->createStub(Component::class);
38 $this->of_component = new D\OfComponent(
39 $this->component
40 );
41 }
42
43 public function testGetComponent(): void
44 {
45 $this->assertEquals($this->component, $this->of_component->getComponent());
46 }
47
48 public function testInDependencies(): void
49 {
50 $name = TestInterface::class;
51
52 $out = new D\Out(D\OutType::PROVIDE, $name, "Some\\Class", []);
53 $in = new D\In(D\InType::PULL, $name);
54
56 $this->component,
57 $in,
58 $out
59 );
60
61 $result = iterator_to_array($of_component->getInDependencies());
62
63 $this->assertEquals([$in], $result);
64 }
65}
$out
Definition: buildRTE.php:24
A dependency where the component needs something from the world.
Definition: In.php:27
A dependency where the component gives something to the world.
Definition: Out.php:27
PHPUnit Framework MockObject Stub $component