3 declare(strict_types=1);
35 '.phpunit.result.cache',
36 'captainhook.local.json',
38 'phpstan-baseline.neon',
40 '.php-cs-fixer.cache',
72 'studip_referrer.php',
73 'unzip_test_file.zip',
115 self::ALLOWED_ROOT_FOLDER_DIRS,
116 explode(
",", (
string) getenv(
'ALLOWED_ROOT_FOLDER_DIRS'))
119 self::ALLOWED_ROOT_FOLDER_FILES,
120 explode(
",", (
string) getenv(
'ALLOWED_ROOT_FOLDER_FILES'))
126 $app_root_folder = getcwd();
128 for ($i = 0; $i < 20 && !is_file($app_root_folder .
'/index.php'); $i++) {
129 $app_root_folder .=
'/..';
132 if (!is_file($app_root_folder .
'/index.php')) {
133 $this->fail(
'Could not determine ILIAS root folder');
136 return $app_root_folder;
139 public function testAppRootFolderOnlyContainsDefinedFiles():
void 142 $iter =
new CallbackFilterIterator(
144 static function (DirectoryIterator $file):
bool {
145 return $file->isFile();
148 foreach ($iter as $file) {
150 $found_files[] = $file->getBasename();
159 'The following files are not expected in the ILIAS root folder: %s',
160 implode(
', ', $unexpected_files)
165 public function testAppRootFolderOnlyContainsDefinedFolders():
void 167 $found_directories = [];
168 $iter =
new CallbackFilterIterator(
170 static function (DirectoryIterator $file):
bool {
171 return $file->isDir() && !$file->isDot();
174 foreach ($iter as $file) {
176 $found_directories[] = $file->getBasename();
180 sort($unexpected_directories);
183 $unexpected_directories,
185 'The following directories are not expected in the ILIAS root folder: %s',
186 implode(
', ', $unexpected_directories)
const ALLOWED_ROOT_FOLDER_FILES
const ALLOWED_ROOT_FOLDER_DIRS
array $ALLOWED_ROOT_FOLDER_DIRS
array $ALLOWED_ROOT_FOLDER_FILES