ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
FactoryImplTest.php
Go to the documentation of this file.
1<?php
2
20
27use PHPUnit\Framework\TestCase;
28use ReflectionClass;
29use ReflectionMethod;
30
31require_once('./vendor/composer/vendor/autoload.php');
32
38class FactoryImplTest extends TestCase
39{
44
45
49 protected function setUp(): void
50 {
51 parent::setUp();
52
53 $this->identification = new IdentificationFactory(new NullProviderFactory());
54 $this->provider = $this->getMockBuilder(StaticMainMenuProvider::class)->getMock();
55
56 $this->id = $this->identification->core($this->provider)->identifier('dummy');
57
58 $this->factory = new MainMenuItemFactory();
59 }
60
61
62 public function testAvailableMethods(): void
63 {
64 $r = new ReflectionClass($this->factory);
65
66 $methods = [];
67 foreach ($r->getMethods(ReflectionMethod::IS_PUBLIC) as $method) {
68 $methods[] = $method->getName();
69 }
70 sort($methods);
71 $this->assertSame(
72 [
73 0 => 'complex',
74 1 => 'custom',
75 2 => 'link',
76 3 => 'linkList',
77 4 => 'repositoryLink',
78 5 => 'separator',
79 6 => 'topLinkItem',
80 7 => 'topParentItem',
81 ],
82 $methods
83 );
84 }
85
86
87 public function testInterchangeableContraints(): void
88 {
89 $this->assertInstanceOf(isInterchangeableItem::class, $this->factory->topLinkItem($this->id));
90 $this->assertNotInstanceOf(isInterchangeableItem::class, $this->factory->topParentItem($this->id));
91 $this->assertInstanceOf(isInterchangeableItem::class, $this->factory->complex($this->id));
92 $this->assertInstanceOf(isInterchangeableItem::class, $this->factory->link($this->id));
93 $this->assertInstanceOf(isInterchangeableItem::class, $this->factory->repositoryLink($this->id));
94 $this->assertNotInstanceOf(isInterchangeableItem::class, $this->factory->separator($this->id));
95 }
96}
factory()
Class IdentificationFactory All elements in the GlobalScreen service must be identifiable for the sup...
Class MainMenuItemFactory This factory provides you all available types for MainMenu GlobalScreen Ite...
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...