ILIAS  release_8 Revision v8.24
FlySystemLocalFilesystemFactoryTest.php
Go to the documentation of this file.
1<?php
2
4
7use Mockery\Adapter\Phpunit\MockeryPHPUnitIntegration;
8use PHPUnit\Framework\TestCase;
9
10/******************************************************************************
11 *
12 * This file is part of ILIAS, a powerful learning management system.
13 *
14 * ILIAS is licensed with the GPL-3.0, you should have received a copy
15 * of said license along with the source code.
16 *
17 * If this is not the case or you just want to try ILIAS, you'll find
18 * us at:
19 * https://www.ilias.de
20 * https://github.com/ILIAS-eLearning
21 *
22 *****************************************************************************/
34{
35 use MockeryPHPUnitIntegration;
36
37 private \ILIAS\Filesystem\Provider\FlySystem\FlySystemLocalFilesystemFactory $subject;
38
39
44 protected function setUp(): void
45 {
46 parent::setUp();
47
48 $this->subject = new FlySystemLocalFilesystemFactory();
49 }
50
56 {
57 $rootPath = __DIR__;
58
59 $privateAccessFile = 0700;
60 $privateAccessDir = 0700;
61
62 $publicAccessFile = 0744;
63 $publicAccessDir = 0755;
64 $lockMode = LOCK_EX;
65
66 $config = new LocalConfig(
67 $rootPath,
68 $publicAccessFile,
69 $privateAccessFile,
70 $publicAccessDir,
71 $privateAccessDir,
72 $lockMode,
74 );
75
76 $filesystem = $this->subject->getInstance($config);
77 $this->assertInstanceOf(FilesystemFacade::class, $filesystem, "Filesystem type must be " . FilesystemFacade::class);
78 }
79
85 {
86 $rootPath = __DIR__;
87
88 $privateAccessFile = 0700;
89 $privateAccessDir = 0700;
90
91 $publicAccessFile = 0744;
92 $publicAccessDir = 0755;
93 $lockMode = LOCK_EX;
94 $invalidLinkBehaviour = 9999;
95
96 $config = new LocalConfig(
97 $rootPath,
98 $publicAccessFile,
99 $privateAccessFile,
100 $publicAccessDir,
101 $privateAccessDir,
102 $lockMode,
103 $invalidLinkBehaviour
104 );
105
106 $this->expectException(\InvalidArgumentException::class);
107 $this->expectExceptionMessage("The supplied value \"$invalidLinkBehaviour\" is not a valid LocalConfig link behaviour constant.");
108
109 $this->subject->getInstance($config);
110 }
111
117 {
118 $rootPath = __DIR__;
119
120 $privateAccessFile = 0700;
121 $privateAccessDir = 0700;
122
123 $publicAccessFile = 0744;
124 $publicAccessDir = 0755;
125 $invalidLockMode = 9999;
126
127 $config = new LocalConfig(
128 $rootPath,
129 $publicAccessFile,
130 $privateAccessFile,
131 $publicAccessDir,
132 $privateAccessDir,
133 $invalidLockMode,
135 );
136
137 $this->expectException(\InvalidArgumentException::class);
138 $this->expectExceptionMessage("The supplied value \"$invalidLockMode\" is not a valid file lock mode please check your local file storage configurations.");
139
140 $this->subject->getInstance($config);
141 }
142}
ILIAS Filesystem Provider FlySystem FlySystemLocalFilesystemFactory $subject
if(!array_key_exists('PATH_INFO', $_SERVER)) $config
Definition: metadata.php:85