19 declare(strict_types=1);
31 '.phpunit.result.cache',
32 'captainhook.local.json',
34 'phpstan-baseline.neon',
36 '.php-cs-fixer.cache',
48 'unzip_test_file.zip',
75 protected function setUp(): void
77 $this->ALLOWED_ROOT_FOLDER_DIRS = array_merge(
78 self::ALLOWED_ROOT_FOLDER_DIRS,
79 explode(
",", (
string) getenv(
'ALLOWED_ROOT_FOLDER_DIRS'))
81 $this->ALLOWED_ROOT_FOLDER_FILES = array_merge(
82 self::ALLOWED_ROOT_FOLDER_FILES,
83 explode(
",", (
string) getenv(
'ALLOWED_ROOT_FOLDER_FILES'))
89 $app_root_folder = __DIR__ .
"/../../../../";
91 if (!is_file($app_root_folder .
'/ilias_version.php')) {
92 $this->fail(
'Could not determine ILIAS root folder');
95 return $app_root_folder;
98 public function testAppRootFolderOnlyContainsDefinedFiles():
void 101 $iter = new \CallbackFilterIterator(
104 return $file->isFile();
107 foreach ($iter as $file) {
109 $found_files[] = $file->getBasename();
113 $unexpected_files = array_diff($found_files, $this->ALLOWED_ROOT_FOLDER_FILES);
118 'The following files are not expected in the ILIAS root folder: %s',
119 implode(
', ', $unexpected_files)
124 public function testAppRootFolderOnlyContainsDefinedFolders():
void 126 $found_directories = [];
127 $iter = new \CallbackFilterIterator(
130 return $file->isDir() && !$file->isDot();
133 foreach ($iter as $file) {
135 $found_directories[] = $file->getBasename();
138 $unexpected_directories = array_diff($found_directories, $this->ALLOWED_ROOT_FOLDER_DIRS);
139 sort($unexpected_directories);
142 $unexpected_directories,
144 'The following directories are not expected in the ILIAS root folder: %s',
145 implode(
', ', $unexpected_directories)
const array ALLOWED_ROOT_FOLDER_FILES
sort()
description: > Example for rendering a Sort Glyph.
array $ALLOWED_ROOT_FOLDER_DIRS
array $ALLOWED_ROOT_FOLDER_FILES
const array ALLOWED_ROOT_FOLDER_DIRS