ILIAS  release_8 Revision v8.24
ilCtrlPathFactoryTest.php
Go to the documentation of this file.
1<?php
2
3declare(strict_types=1);
4
5/* Copyright (c) 2021 Thibeau Fuhrer <thf@studer-raimann.ch> Extended GPL, see docs/LICENSE */
6
7require_once __DIR__ . '/ilCtrlPathTestBase.php';
8
15{
20
24 protected function setUp(): void
25 {
26 parent::setUp();
27
28 $this->factory = new ilCtrlPathFactory($this->structure);
29 }
30
32 {
33 $context = $this->createMock(ilCtrlContextInterface::class);
34 $path = $this->factory->find($context, ilCtrlBaseClass1TestGUI::class);
35
36 $this->assertEquals('0', $path->getCidPath());
37 $this->assertInstanceOf(
38 ilCtrlSingleClassPath::class,
39 $path
40 );
41 }
42
44 {
45 $context = $this->createMock(ilCtrlContextInterface::class);
46 $path = $this->factory->find($context, [
47 ilCtrlBaseClass1TestGUI::class,
48 ilCtrlCommandClass1TestGUI::class,
49 ]);
50
51 $this->assertEquals('0:2', $path->getCidPath());
52 $this->assertInstanceOf(
53 ilCtrlArrayClassPath::class,
54 $path
55 );
56 }
57
58 public function testPathFactoryNullPath(): void
59 {
60 $path = $this->factory->null();
61
62 $this->assertNull($path->getCidPath());
63 $this->assertInstanceOf(
64 ilCtrlNullPath::class,
65 $path
66 );
67 }
68
69 public function testPathFactoryExistingPath(): void
70 {
71 $path = $this->factory->existing('foo');
72
73 $this->assertEquals('foo', $path->getCidPath());
74 $this->assertInstanceOf(
75 ilCtrlExistingPath::class,
76 $path
77 );
78 }
79}
Class ilCtrlPathFactoryTest.
Class ilCtrlPathFactory.
Class ilCtrlPathTestBase.
$path
Definition: ltiservices.php:32
$context
Definition: webdav.php:29