ILIAS  release_9 Revision v9.13-25-g2c18ec4c24f
ilSystemStyleBaseFS.php
Go to the documentation of this file.
1 <?php
2 
19 declare(strict_types=1);
20 
21 require_once('libs/composer/vendor/autoload.php');
22 
24 
25 abstract class ilSystemStyleBaseFS extends TestCase
26 {
29  protected ilSkinStyle $style;
31  protected ?ILIAS\DI\Container $save_dic = null;
32  protected ilLanguage $lng;
34 
35  protected function setUp(): void
36  {
37  global $DIC;
38  $DIC['tpl'] = $this->getMockBuilder(ilGlobalTemplateInterface::class)->getMock();
39  $this->system_style_config = new ilSystemStyleConfigMock();
40  $this->message_stack = new ilSystemStyleMessageStack($DIC['tpl']);
41 
42  if (!file_exists($this->system_style_config->test_skin_temp_path)) {
43  mkdir($this->system_style_config->test_skin_temp_path);
44  }
45 
47  include_once('./tests/UI/Base.php');
48  $this->lng = new ilLanguageMock();
49 
50  $this->file_system = new ilFileSystemHelper($this->lng, $this->message_stack);
51  $this->file_system->recursiveCopy(
52  $this->system_style_config->test_skin_original_path,
53  $this->system_style_config->test_skin_temp_path
54  );
55 
56  $factory = new ilSkinFactory($this->lng, $this->system_style_config);
57  $this->container = $factory->skinStyleContainerFromId('skin1', $this->message_stack);
58  $this->style = $this->container->getSkin()->getStyle('style1');
59  }
60 
61  protected function getAllContentOfFolder(string $directory): string
62  {
63  $files = scandir($directory);
64  $content = "";
65 
66  foreach ($files as $file) {
67  if (is_file($directory . '/' . $file)) {
68  $content .= file_get_contents($directory . '/' . $file);
69  }
70  }
71 
72  return $content;
73  }
74 
75  protected function tearDown(): void
76  {
77  $this->file_system->recursiveRemoveDir($this->system_style_config->test_skin_temp_path);
78  }
79 }
Factory to create Skin classes holds an manages the basic data of a skin as provide by the template o...
File System Helper, to reduce deps.
This class is responsible for all file system related actions related actions of a skin such as copyi...
global $DIC
Definition: feed.php:28
ilSystemStyleConfigMock $system_style_config
getAllContentOfFolder(string $directory)
ilSystemStyleMessageStack $message_stack
ilSystemStyleConfig wraps all &#39;constants&#39; to ensure the testability of all classes using those &#39;const...
ilSkinStyleContainer $container
Used to stack messages to be shown to the user.
ilFileSystemHelper $file_system
ILIAS DI Container $save_dic