ILIAS  release_8 Revision v8.24
FactoryImplTest.php
Go to the documentation of this file.
1<?php
2
4
11use PHPUnit\Framework\TestCase;
12use ReflectionClass;
13use ReflectionMethod;
14
15require_once('./libs/composer/vendor/autoload.php');
16
22class FactoryImplTest extends TestCase
23{
28
29
33 protected function setUp(): void
34 {
35 parent::setUp();
36
37 $this->identification = new IdentificationFactory(new NullProviderFactory());
38 $this->provider = $this->getMockBuilder(StaticMainMenuProvider::class)->getMock();
39
40 $this->id = $this->identification->core($this->provider)->identifier('dummy');
41
42 $this->factory = new MainMenuItemFactory();
43 }
44
45
46 public function testAvailableMethods(): void
47 {
48 $r = new ReflectionClass($this->factory);
49
50 $methods = [];
51 foreach ($r->getMethods(ReflectionMethod::IS_PUBLIC) as $method) {
52 $methods[] = $method->getName();
53 }
54 sort($methods);
55 $this->assertEquals(
56 [
57 0 => 'complex',
58 1 => 'custom',
59 2 => 'link',
60 3 => 'linkList',
61 4 => 'repositoryLink',
62 5 => 'separator',
63 6 => 'topLinkItem',
64 7 => 'topParentItem',
65 ],
66 $methods
67 );
68 }
69
70
71 public function testInterchangeableContraints(): void
72 {
73 $this->assertInstanceOf(isInterchangeableItem::class, $this->factory->topLinkItem($this->id));
74 $this->assertNotInstanceOf(isInterchangeableItem::class, $this->factory->topParentItem($this->id));
75 $this->assertInstanceOf(isInterchangeableItem::class, $this->factory->complex($this->id));
76 $this->assertInstanceOf(isInterchangeableItem::class, $this->factory->link($this->id));
77 $this->assertInstanceOf(isInterchangeableItem::class, $this->factory->repositoryLink($this->id));
78 $this->assertNotInstanceOf(isInterchangeableItem::class, $this->factory->separator($this->id));
79 }
80}
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...