ILIAS  release_8 Revision v8.24
ImplementationOfInterfaceFinderTest.php
Go to the documentation of this file.
1<?php
2
3declare(strict_types=1);
4
21namespace ILIAS\Tests\Setup;
22
24use PHPUnit\Framework\TestCase;
25
27{
28 public array $class_names = [];
29
30 protected function getAllClassNames(array $additional_ignore, string $matching_path = null): \Iterator
31 {
32 foreach ($this->class_names as $name) {
33 yield $name;
34 }
35 }
36}
37
39{
40}
41
43{
44}
45
47{
48}
49
50class TestClass1 implements TestInterface1
51{
52}
53
54class TestClass2 implements TestInterface2
55{
56}
57
59{
60}
61
63{
64 public function testWithTestInterface1()
65 {
67 $finder->class_names = [
68 TestClass1::class,
69 TestClass2::class,
70 TestClass3::class
71 ];
72 $expected = [TestClass1::class, TestClass3::class];
73 $result = iterator_to_array($finder->getMatchingClassNames(TestInterface1::class));
74 $this->assertEquals($expected, $result);
75 }
76
77 public function testWithTestInterface2()
78 {
80 $finder->class_names = [
81 TestClass1::class,
82 TestClass2::class,
83 TestClass3::class
84 ];
85 $expected = [TestClass2::class, TestClass3::class];
86 $result = iterator_to_array($finder->getMatchingClassNames(TestInterface2::class));
87 $this->assertEquals($expected, $result);
88 }
89
90 public function testWithTestInterface3()
91 {
93 $finder->class_names = [
94 TestClass1::class,
95 TestClass2::class,
96 TestClass3::class
97 ];
98 $expected = [];
99 $result = iterator_to_array($finder->getMatchingClassNames(TestInterface3::class));
100 $this->assertEquals($expected, $result);
101 }
102}
getAllClassNames(array $additional_ignore, string $matching_path=null)
if($format !==null) $name
Definition: metadata.php:247
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...