◆ setUp()
ilSkinStyleLessFileTest::setUp |
( |
| ) |
|
|
protected |
Definition at line 34 of file ilSkinStyleLessFileTest.php.
References $DIC, ilSystemStyleSkinContainer\generateFromId(), and ilSystemStyleSkinContainer\xCopy().
42 mkdir($this->system_style_config->test_skin_temp_path);
46 $this->style = $this->container->getSkin()->getStyle(
"style1");
static generateFromId($skin_id, ilSystemStyleMessageStack $message_stack=null, ilSystemStyleConfig $system_styles_conf=null)
Generate the container class by parsing the corresponding XML.
ilSystemStyleConfig wraps all 'constants' to ensure the testability of all classes using those 'const...
static xCopy($src, $dest)
Recursive copy of a folder.
◆ tearDown()
ilSkinStyleLessFileTest::tearDown |
( |
| ) |
|
|
protected |
◆ testAddAndWriteItems()
ilSkinStyleLessFileTest::testAddAndWriteItems |
( |
| ) |
|
Definition at line 197 of file ilSkinStyleLessFileTest.php.
206 $expected_variable13 =
new ilSystemStyleLessVariable(
"variable13",
"@variable11",
"comment variable 13",
"Category 1", [
"variable11"]);
212 $expected_variable21 =
new ilSystemStyleLessVariable(
"variable21",
"@variable11",
"comment variable 21",
"Category 2", [
"variable11"]);
214 $expected_variable23 =
new ilSystemStyleLessVariable(
"variable23",
"@variable21",
"comment variable 23",
"Category 2", [
"variable21"]);
216 $expected_items = [$expected_category1,
217 $expected_comment2,$expected_comment3,
218 $expected_variable11,$expected_variable12,$expected_variable13,
221 $expected_comment6,$expected_comment7,$expected_comment8,
222 $expected_variable21,$expected_variable22,$expected_variable23];
224 foreach ($expected_items as $item) {
225 $empty_less->addItem($item);
227 $empty_less->write();
230 $this->assertEquals($expected_items, $new_less->getItems());
Capsules data of a less category in the variables to less file.
◆ testChangeVariable()
ilSkinStyleLessFileTest::testChangeVariable |
( |
| ) |
|
Definition at line 165 of file ilSkinStyleLessFileTest.php.
167 $file =
new ilSystemStyleLessFile($this->container->getLessVariablesFilePath($this->style->getId()));
168 $variable = $file->getVariableByName(
"variable11");
169 $variable->setValue(
"newvalue11");
174 $expected_variable11 =
new ilSystemStyleLessVariable(
"variable11",
"newvalue11",
"comment variable 11",
"Category 1", []);
176 $expected_variable13 =
new ilSystemStyleLessVariable(
"variable13",
"@variable11",
"comment variable 13",
"Category 1", [
"variable11"]);
182 $expected_variable21 =
new ilSystemStyleLessVariable(
"variable21",
"@variable11",
"comment variable 21",
"Category 2", [
"variable11"]);
184 $expected_variable23 =
new ilSystemStyleLessVariable(
"variable23",
"@variable21",
"comment variable 23",
"Category 2", [
"variable21"]);
186 $expected_items = [$expected_category1,
187 $expected_comment2,$expected_comment3,
188 $expected_variable11,$expected_variable12,$expected_variable13,
191 $expected_comment6,$expected_comment7,$expected_comment8,
192 $expected_variable21,$expected_variable22,$expected_variable23];
194 $this->assertEquals($expected_items, $file->getItems());
Capsules data of a less category in the variables to less file.
◆ testConstructAndRead()
ilSkinStyleLessFileTest::testConstructAndRead |
( |
| ) |
|
◆ testGetCategory()
ilSkinStyleLessFileTest::testGetCategory |
( |
| ) |
|
Definition at line 91 of file ilSkinStyleLessFileTest.php.
97 $expected_categories = [$expected_category1,$expected_category2];
99 $this->assertEquals($expected_categories, $file->getCategories());
Capsules data of a less category in the variables to less file.
◆ testGetContent()
ilSkinStyleLessFileTest::testGetContent |
( |
| ) |
|
Definition at line 132 of file ilSkinStyleLessFileTest.php.
134 $file =
new ilSystemStyleLessFile($this->container->getLessVariablesFilePath($this->style->getId()));
135 $expected_content = file_get_contents($this->container->getLessVariablesFilePath($this->style->getId()));
136 $this->assertEquals($expected_content, $file->getContent());
◆ testGetItems()
ilSkinStyleLessFileTest::testGetItems |
( |
| ) |
|
Definition at line 102 of file ilSkinStyleLessFileTest.php.
104 $file =
new ilSystemStyleLessFile($this->container->getLessVariablesFilePath($this->style->getId()));
111 $expected_variable13 =
new ilSystemStyleLessVariable(
"variable13",
"@variable11",
"comment variable 13",
"Category 1", [
"variable11"]);
117 $expected_variable21 =
new ilSystemStyleLessVariable(
"variable21",
"@variable11",
"comment variable 21",
"Category 2", [
"variable11"]);
119 $expected_variable23 =
new ilSystemStyleLessVariable(
"variable23",
"@variable21",
"comment variable 23",
"Category 2", [
"variable21"]);
121 $expected_items = [$expected_category1,
122 $expected_comment2,$expected_comment3,
123 $expected_variable11,$expected_variable12,$expected_variable13,
126 $expected_comment6,$expected_comment7,$expected_comment8,
127 $expected_variable21,$expected_variable22,$expected_variable23];
129 $this->assertEquals($expected_items, $file->getItems());
Capsules data of a less category in the variables to less file.
◆ testGetItemsEdgeCases()
ilSkinStyleLessFileTest::testGetItemsEdgeCases |
( |
| ) |
|
Definition at line 268 of file ilSkinStyleLessFileTest.php.
280 $expected_variable21 =
new ilSystemStyleLessVariable(
"variableNoValidSection1",
"value21",
"",
"Category 1 no valid section", []);
281 $expected_variable22 =
new ilSystemStyleLessVariable(
"variableNoValidSection2",
"value22",
"comment",
"Category 1 no valid section", []);
288 $expected_variable32 =
new ilSystemStyleLessVariable(
"variable21",
"floor((@regular * 1.6)) * lighten(@regular, 20%)",
"Hard references",
"Category 2", [
"regular"]);
295 $expected_items = [$expected_comment1,$expected_comment2,
296 $expected_variable11,$expected_variable12,
297 $expected_category1,$expected_variable21,$expected_variable22,
299 $expected_category2,$expected_variable31,$expected_variable32,
301 $expected_category3,$expected_variable41];
303 $this->assertEquals($expected_items, $file->getItems());
Capsules data of a less category in the variables to less file.
◆ testGetVariableByName()
ilSkinStyleLessFileTest::testGetVariableByName |
( |
| ) |
|
Definition at line 70 of file ilSkinStyleLessFileTest.php.
76 $expected_variable13 =
new ilSystemStyleLessVariable(
"variable13",
"@variable11",
"comment variable 13",
"Category 1", [
"variable11"]);
78 $expected_variable21 =
new ilSystemStyleLessVariable(
"variable21",
"@variable11",
"comment variable 21",
"Category 2", [
"variable11"]);
80 $expected_variable23 =
new ilSystemStyleLessVariable(
"variable23",
"@variable21",
"comment variable 23",
"Category 2", [
"variable21"]);
82 $this->assertEquals($expected_variable11, $file->getVariableByName(
"variable11"));
83 $this->assertEquals($expected_variable12, $file->getVariableByName(
"variable12"));
84 $this->assertEquals($expected_variable13, $file->getVariableByName(
"variable13"));
86 $this->assertEquals($expected_variable21, $file->getVariableByName(
"variable21"));
87 $this->assertEquals($expected_variable22, $file->getVariableByName(
"variable22"));
88 $this->assertEquals($expected_variable23, $file->getVariableByName(
"variable23"));
◆ testGetVariableReferences()
ilSkinStyleLessFileTest::testGetVariableReferences |
( |
| ) |
|
Definition at line 233 of file ilSkinStyleLessFileTest.php.
235 $file =
new ilSystemStyleLessFile($this->container->getLessVariablesFilePath($this->style->getId()));
237 $this->assertEquals([
"variable13",
"variable21"], $file->getReferencesToVariable(
"variable11"));
238 $this->assertEquals([], $file->getReferencesToVariable(
"variable12"));
239 $this->assertEquals([], $file->getReferencesToVariable(
"variable13"));
241 $this->assertEquals([
"variable23"], $file->getReferencesToVariable(
"variable21"));
242 $this->assertEquals([], $file->getReferencesToVariable(
"variable22"));
243 $this->assertEquals([], $file->getReferencesToVariable(
"variable23"));
◆ testGetVariableReferencesAsString()
ilSkinStyleLessFileTest::testGetVariableReferencesAsString |
( |
| ) |
|
Definition at line 246 of file ilSkinStyleLessFileTest.php.
248 $file =
new ilSystemStyleLessFile($this->container->getLessVariablesFilePath($this->style->getId()));
250 $this->assertEquals(
"variable13; variable21; ", $file->getReferencesToVariableAsString(
"variable11"));
251 $this->assertEquals(
"", $file->getReferencesToVariableAsString(
"variable12"));
252 $this->assertEquals(
"", $file->getReferencesToVariableAsString(
"variable13"));
254 $this->assertEquals(
"variable23; ", $file->getReferencesToVariableAsString(
"variable21"));
255 $this->assertEquals(
"", $file->getReferencesToVariableAsString(
"variable22"));
256 $this->assertEquals(
"", $file->getReferencesToVariableAsString(
"variable23"));
◆ testReadCorrectTypes()
ilSkinStyleLessFileTest::testReadCorrectTypes |
( |
| ) |
|
Definition at line 60 of file ilSkinStyleLessFileTest.php.
64 $this->assertEquals(2, count($file->getCategories()));
65 $this->assertEquals(6, count($file->getVariablesIds()));
66 $this->assertEquals(6, count($file->getCommentsIds()));
◆ testReadCorrectTypesEdgeCases()
ilSkinStyleLessFileTest::testReadCorrectTypesEdgeCases |
( |
| ) |
|
Definition at line 259 of file ilSkinStyleLessFileTest.php.
263 $this->assertEquals(3, count($file->getCategories()));
264 $this->assertEquals(7, count($file->getVariablesIds()));
265 $this->assertEquals(4, count($file->getCommentsIds()));
◆ testReadWriteDouble()
ilSkinStyleLessFileTest::testReadWriteDouble |
( |
| ) |
|
Definition at line 139 of file ilSkinStyleLessFileTest.php.
141 $expected_content = file_get_contents($this->container->getLessVariablesFilePath($this->style->getId()));
143 $file =
new ilSystemStyleLessFile($this->container->getLessVariablesFilePath($this->style->getId()));
145 $file =
new ilSystemStyleLessFile($this->container->getLessVariablesFilePath($this->style->getId()));
147 $file =
new ilSystemStyleLessFile($this->container->getLessVariablesFilePath($this->style->getId()));
149 $this->assertEquals($expected_content, $file->getContent());
◆ testReadWriteDoubleFullLess()
ilSkinStyleLessFileTest::testReadWriteDoubleFullLess |
( |
| ) |
|
Definition at line 152 of file ilSkinStyleLessFileTest.php.
References ilSystemStyleLessFile\write().
154 $expected_content = file_get_contents($this->container->getSkinDirectory() .
"full.less");
162 $this->assertEquals($expected_content, $file->getContent());
write()
Write the complete file back to the file system (including comments and random content) ...
◆ $container
ilSkinStyleLessFileTest::$container |
|
protected |
◆ $style
ilSkinStyleLessFileTest::$style |
|
protected |
◆ $system_style_config
ilSkinStyleLessFileTest::$system_style_config |
|
protected |
The documentation for this class was generated from the following file: