3include_once(
"Services/Style/System/classes/Utilities/class.ilSkinStyleXML.php");
 
    4include_once(
"Services/Style/System/classes/Utilities/class.ilSkinXML.php");
 
    5include_once(
"Services/Style/System/classes/Utilities/class.ilSystemStyleSkinContainer.php");
 
    6include_once(
"Services/Style/System/test/fixtures/mocks/ilSystemStyleConfigMock.php");
 
    7include_once(
"Services/Style/System/test/fixtures/mocks/ilSystemStyleDICMock.php");
 
    9include_once(
"Services/Style/System/classes/Utilities/class.ilSystemStyleMessageStack.php");
 
   10include_once(
"Services/Utilities/classes/class.ilUtil.php");
 
   47        $this->save_dic = 
$DIC;
 
   50        if (!
defined(
'PATH_TO_LESSC')) {
 
   51            if (file_exists(
"ilias.ini.php")) {
 
   52                $ini = parse_ini_file(
"ilias.ini.php", 
true);
 
   53                define(
'PATH_TO_LESSC', 
$ini[
'tools'][
'lessc']);
 
   55                define(
'PATH_TO_LESSC', 
"");
 
   59        $this->skin = 
new ilSkinXML(
"skin1", 
"skin 1");
 
   62        $this->style1->setCssFile(
"style1css");
 
   63        $this->style1->setImageDirectory(
"style1image");
 
   64        $this->style1->setSoundDirectory(
"style1sound");
 
   65        $this->style1->setFontDirectory(
"style1font");
 
   68        $this->style2->setCssFile(
"style2css");
 
   69        $this->style2->setImageDirectory(
"style2image");
 
   70        $this->style2->setSoundDirectory(
"style2sound");
 
   71        $this->style2->setFontDirectory(
"style2font");
 
   75        mkdir($this->system_style_config->test_skin_temp_path);
 
   90        $this->assertEquals(
$container->getSkin()->getId(), $this->skin->getId());
 
   91        $this->assertEquals(
$container->getSkin()->getName(), $this->skin->getName());
 
   93        $this->assertEquals(
$container->getSkin()->getStyle($this->style1->getId()), $this->style1);
 
   94        $this->assertEquals(
$container->getSkin()->getStyle($this->style2->getId()), $this->style2);
 
  104        $this->assertTrue(is_dir($this->system_style_config->getCustomizingSkinPath() . 
"newSkin"));
 
  106        $this->assertFalse(is_dir($this->system_style_config->getCustomizingSkinPath() . 
"newSkin"));
 
  115        $this->assertTrue(is_dir($this->system_style_config->getCustomizingSkinPath() . 
"newSkin2"));
 
  117        $container->getSkin()->setId($this->skin->getId());
 
  119        $this->assertFalse(is_dir($this->system_style_config->getCustomizingSkinPath() . 
"newSkin2"));
 
  125        $new_style->setCssFile(
"style1new");
 
  126        $new_style->setImageDirectory(
"style1newimage");
 
  127        $new_style->setSoundDirectory(
"style1newsound");
 
  128        $new_style->setFontDirectory(
"style1newfont");
 
  132        $this->assertTrue(is_dir($this->system_style_config->getCustomizingSkinPath() . $this->skin->getId() . 
"/style1image"));
 
  133        $this->assertTrue(is_dir($this->system_style_config->getCustomizingSkinPath() . $this->skin->getId() . 
"/style1sound"));
 
  134        $this->assertTrue(is_dir($this->system_style_config->getCustomizingSkinPath() . $this->skin->getId() . 
"/style1font"));
 
  135        $this->assertTrue(is_file($this->system_style_config->getCustomizingSkinPath() . $this->skin->getId() . 
"/style1css.css"));
 
  136        $this->assertTrue(is_file($this->system_style_config->getCustomizingSkinPath() . $this->skin->getId() . 
"/style1css.less"));
 
  137        $this->assertTrue(is_file($this->system_style_config->getCustomizingSkinPath() . $this->skin->getId() . 
"/style1css-variables.less"));
 
  139        $this->assertFalse(is_dir($this->system_style_config->getCustomizingSkinPath() . $this->skin->getId() . 
"/style1newimage"));
 
  140        $this->assertFalse(is_dir($this->system_style_config->getCustomizingSkinPath() . $this->skin->getId() . 
"/style1newsound"));
 
  141        $this->assertFalse(is_dir($this->system_style_config->getCustomizingSkinPath() . $this->skin->getId() . 
"/style1newfont"));
 
  142        $this->assertFalse(is_file($this->system_style_config->getCustomizingSkinPath() . $this->skin->getId() . 
"/style1new.css"));
 
  143        $this->assertFalse(is_file($this->system_style_config->getCustomizingSkinPath() . $this->skin->getId() . 
"/style1new.less"));
 
  144        $this->assertFalse(is_file($this->system_style_config->getCustomizingSkinPath() . $this->skin->getId() . 
"/style1new-variables.less"));
 
  148        $this->assertTrue(is_dir($this->system_style_config->getCustomizingSkinPath() . $this->skin->getId() . 
"/style1image"));
 
  149        $this->assertTrue(is_dir($this->system_style_config->getCustomizingSkinPath() . $this->skin->getId() . 
"/style1sound"));
 
  150        $this->assertTrue(is_dir($this->system_style_config->getCustomizingSkinPath() . $this->skin->getId() . 
"/style1font"));
 
  151        $this->assertTrue(is_file($this->system_style_config->getCustomizingSkinPath() . $this->skin->getId() . 
"/style1css.css"));
 
  152        $this->assertTrue(is_file($this->system_style_config->getCustomizingSkinPath() . $this->skin->getId() . 
"/style1css.less"));
 
  153        $this->assertTrue(is_file($this->system_style_config->getCustomizingSkinPath() . $this->skin->getId() . 
"/style1css-variables.less"));
 
  155        $this->assertTrue(is_dir($this->system_style_config->getCustomizingSkinPath() . $this->skin->getId() . 
"/style1newimage"));
 
  156        $this->assertTrue(is_dir($this->system_style_config->getCustomizingSkinPath() . $this->skin->getId() . 
"/style1newsound"));
 
  157        $this->assertTrue(is_dir($this->system_style_config->getCustomizingSkinPath() . $this->skin->getId() . 
"/style1newfont"));
 
  158        $this->assertTrue(is_file($this->system_style_config->getCustomizingSkinPath() . $this->skin->getId() . 
"/style1new.css"));
 
  159        $this->assertTrue(is_file($this->system_style_config->getCustomizingSkinPath() . $this->skin->getId() . 
"/style1new.less"));
 
  160        $this->assertTrue(is_file($this->system_style_config->getCustomizingSkinPath() . $this->skin->getId() . 
"/style1new-variables.less"));
 
  169        $this->assertFalse(is_dir($this->system_style_config->getCustomizingSkinPath() . $this->skin->getId() . 
"/style1image"));
 
  170        $this->assertFalse(is_dir($this->system_style_config->getCustomizingSkinPath() . $this->skin->getId() . 
"/style1sound"));
 
  171        $this->assertFalse(is_dir($this->system_style_config->getCustomizingSkinPath() . $this->skin->getId() . 
"/style1font"));
 
  172        $this->assertFalse(is_file($this->system_style_config->getCustomizingSkinPath() . $this->skin->getId() . 
"/style1css.css"));
 
  173        $this->assertFalse(is_file($this->system_style_config->getCustomizingSkinPath() . $this->skin->getId() . 
"/style1css.less"));
 
  174        $this->assertFalse(is_file($this->system_style_config->getCustomizingSkinPath() . $this->skin->getId() . 
"/style1css-variables.less"));
 
  176        $this->assertTrue(is_dir($this->system_style_config->getCustomizingSkinPath() . $this->skin->getId() . 
"/style2image"));
 
  177        $this->assertTrue(is_dir($this->system_style_config->getCustomizingSkinPath() . $this->skin->getId() . 
"/style2sound"));
 
  178        $this->assertTrue(is_dir($this->system_style_config->getCustomizingSkinPath() . $this->skin->getId() . 
"/style2font"));
 
  179        $this->assertTrue(is_file($this->system_style_config->getCustomizingSkinPath() . $this->skin->getId() . 
"/style2css.css"));
 
  180        $this->assertTrue(is_file($this->system_style_config->getCustomizingSkinPath() . $this->skin->getId() . 
"/style2css.less"));
 
  181        $this->assertTrue(is_file($this->system_style_config->getCustomizingSkinPath() . $this->skin->getId() . 
"/style2css-variables.less"));
 
  189        $old_style = clone 
$skin->getStyle($this->style1->getId());
 
  190        $new_style = 
$skin->getStyle($this->style1->getId());
 
  192        $new_style->setId(
"style1new");
 
  193        $new_style->setName(
"new Style");
 
  194        $new_style->setCssFile(
"style1new");
 
  195        $new_style->setImageDirectory(
"style1newimage");
 
  196        $new_style->setSoundDirectory(
"style1newsound");
 
  197        $new_style->setFontDirectory(
"style1newfont");
 
  199        $container->updateStyle($new_style->getId(), $old_style);
 
  201        $this->assertFalse(is_dir($this->system_style_config->getCustomizingSkinPath() . $this->skin->getId() . 
"/style1image"));
 
  202        $this->assertFalse(is_dir($this->system_style_config->getCustomizingSkinPath() . $this->skin->getId() . 
"/style1sound"));
 
  203        $this->assertFalse(is_dir($this->system_style_config->getCustomizingSkinPath() . $this->skin->getId() . 
"/style1font"));
 
  204        $this->assertFalse(is_file($this->system_style_config->getCustomizingSkinPath() . $this->skin->getId() . 
"/style1css.css"));
 
  205        $this->assertFalse(is_file($this->system_style_config->getCustomizingSkinPath() . $this->skin->getId() . 
"/style1css.less"));
 
  206        $this->assertFalse(is_file($this->system_style_config->getCustomizingSkinPath() . $this->skin->getId() . 
"/style1css-variables.less"));
 
  208        $this->assertTrue(is_dir($this->system_style_config->getCustomizingSkinPath() . $this->skin->getId() . 
"/style1newimage"));
 
  209        $this->assertTrue(is_dir($this->system_style_config->getCustomizingSkinPath() . $this->skin->getId() . 
"/style1newsound"));
 
  210        $this->assertTrue(is_dir($this->system_style_config->getCustomizingSkinPath() . $this->skin->getId() . 
"/style1newfont"));
 
  211        $this->assertTrue(is_file($this->system_style_config->getCustomizingSkinPath() . $this->skin->getId() . 
"/style1new.css"));
 
  212        $this->assertTrue(is_file($this->system_style_config->getCustomizingSkinPath() . $this->skin->getId() . 
"/style1new.less"));
 
  213        $this->assertTrue(is_file($this->system_style_config->getCustomizingSkinPath() . $this->skin->getId() . 
"/style1new-variables.less"));
 
  221        $this->assertTrue(is_dir($this->system_style_config->getCustomizingSkinPath() . 
$skin->getId()));
 
  223        $this->assertFalse(is_dir($this->system_style_config->getCustomizingSkinPath() . 
$skin->getId()));
 
  231        $this->assertFalse(is_dir($this->system_style_config->getCustomizingSkinPath() . 
$skin->getId() . 
"Copy"));
 
  234        $skin_copy =  $container_copy->getSkin();
 
  236        $this->assertTrue(is_dir($this->system_style_config->getCustomizingSkinPath() . 
$skin->getId() . 
"Copy"));
 
  237        $this->assertTrue(is_dir($this->system_style_config->getCustomizingSkinPath() . $skin_copy->getId()));
 
  238        $this->assertTrue(is_dir($this->system_style_config->getCustomizingSkinPath() . $skin_copy->getId() . 
"/style1image"));
 
  239        $this->assertTrue(is_dir($this->system_style_config->getCustomizingSkinPath() . $skin_copy->getId() . 
"/style1sound"));
 
  240        $this->assertTrue(is_dir($this->system_style_config->getCustomizingSkinPath() . $skin_copy->getId() . 
"/style1font"));
 
  241        $this->assertTrue(is_file($this->system_style_config->getCustomizingSkinPath() . $skin_copy->getId() . 
"/style1css.css"));
 
  242        $this->assertTrue(is_file($this->system_style_config->getCustomizingSkinPath() . $skin_copy->getId() . 
"/style1css.less"));
 
  243        $this->assertTrue(is_file($this->system_style_config->getCustomizingSkinPath() . $skin_copy->getId() . 
"/style1css-variables.less"));
 
  249            if (file_exists(
"ilias.ini.php")) {
 
  250                $ini = parse_ini_file(
"ilias.ini.php", 
true);
 
  251                define(
'PATH_TO_ZIP', 
$ini[
'tools'][
'zip']);
 
  253                define(
'PATH_TO_ZIP', 
"");
 
  257        if (!
defined(
'PATH_TO_UNZIP')) {
 
  258            if (file_exists(
"ilias.ini.php")) {
 
  259                $ini = parse_ini_file(
"ilias.ini.php", 
true);
 
  260                define(
'PATH_TO_UNZIP', 
$ini[
'tools'][
'unzip']);
 
  262                define(
'PATH_TO_UNZIP', 
"");
 
  267        if (PATH_TO_UNZIP != 
"") {
 
  271            $this->assertFalse(is_dir($this->system_style_config->getCustomizingSkinPath() . 
$skin->getId() . 
"Copy"));
 
  273            $container_import = 
$container->import(
$container->createTempZip(), $this->skin->getId() . 
".zip", 
null, $this->system_style_config, 
false);
 
  274            $skin_copy =  $container_import->getSkin();
 
  276            $this->assertTrue(is_dir($this->system_style_config->getCustomizingSkinPath() . 
$skin->getId() . 
"Copy"));
 
  277            $this->assertTrue(is_dir($this->system_style_config->getCustomizingSkinPath() . $skin_copy->getId()));
 
  278            $this->assertTrue(is_dir($this->system_style_config->getCustomizingSkinPath() . $skin_copy->getId() . 
"/style1image"));
 
  279            $this->assertTrue(is_dir($this->system_style_config->getCustomizingSkinPath() . $skin_copy->getId() . 
"/style1sound"));
 
  280            $this->assertTrue(is_dir($this->system_style_config->getCustomizingSkinPath() . $skin_copy->getId() . 
"/style1font"));
 
  281            $this->assertTrue(is_file($this->system_style_config->getCustomizingSkinPath() . $skin_copy->getId() . 
"/style1css.css"));
 
  282            $this->assertTrue(is_file($this->system_style_config->getCustomizingSkinPath() . $skin_copy->getId() . 
"/style1css.less"));
 
  283            $this->assertTrue(is_file($this->system_style_config->getCustomizingSkinPath() . $skin_copy->getId() . 
"/style1css-variables.less"));
 
  285            $this->markTestIncomplete(
'No unzip has been detected on the system');
 
An exception for terminatinating execution or to throw for unit testing.
ilSkinXml holds an manages the basic data of a skin as provide by the template of the skin.
ilSystemStyleConfig wraps all 'constants' to ensure the testability of all classes using those 'const...
Used to stack messages to be shown to the user.
static recursiveRemoveDir($dir)
Recursive delete of a folder.
static generateFromId($skin_id, ilSystemStyleMessageStack $message_stack=null, ilSystemStyleConfig $system_styles_conf=null)
Generate the container class by parsing the corresponding XML.
static xCopy($src, $dest)
Recursive copy of a folder.
defined( 'APPLICATION_ENV')||define( 'APPLICATION_ENV'