ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
ilSkinStyleLessVariableTest.php
Go to the documentation of this file.
1<?php
2
3include_once("./Services/Style/System/classes/Less/class.ilSystemStyleLessVariable.php");
4
11{
12 public function testConstruct()
13 {
14 $variable = new ilSystemStyleLessVariable("name", "value", "comment", "category_name", ["references_id"]);
15 $this->assertEquals("name", $variable->getName());
16 $this->assertEquals("value", $variable->getValue());
17 $this->assertEquals("comment", $variable->getComment());
18 $this->assertEquals("category_name", $variable->getCategoryName());
19 $this->assertEquals(["references_id"], $variable->getReferences());
20 }
21
22 public function testSetters()
23 {
24 $variable = new ilSystemStyleLessVariable("name", "value", "comment", "category_name", ["references_id"]);
25
26 $variable->setName("newName");
27 $variable->setValue("newValue");
28 $variable->setComment("newComment");
29 $variable->setCategoryName("new_category_name");
30 $variable->setReferences(["new_references_id"]);
31
32 $this->assertEquals("newName", $variable->getName());
33 $this->assertEquals("newValue", $variable->getValue());
34 $this->assertEquals("newComment", $variable->getComment());
35 $this->assertEquals("new_category_name", $variable->getCategoryName());
36 $this->assertEquals(["new_references_id"], $variable->getReferences());
37 }
38
39 public function testIconFontPathUpdate()
40 {
41 $variable = new ilSystemStyleLessVariable("icon-font-path", "value", "comment", "category_name", ["references_id"]);
42
43 $variable->setValue("\"../../libs/bower/bower_components/bootstrap/fonts/\"");
44 $this->assertEquals("\"../../../../libs/bower/bower_components/bootstrap/fonts/\"", $variable->getValue());
45 }
46
47 public function testIconFontPathQuotation()
48 {
49 $variable = new ilSystemStyleLessVariable("icon-font-path", "value", "comment", "category_name", ["references_id"]);
50
51 $variable->setValue("\"somePath\"");
52 $this->assertEquals("\"somePath\"", $variable->getValue());
53
54 $variable->setValue("somePath");
55 $this->assertEquals("\"somePath\"", $variable->getValue());
56
57
58 $variable->setValue("\"somePath");
59 $this->assertEquals("\"somePath\"", $variable->getValue());
60
61
62 $variable->setValue("somePath\"");
63 $this->assertEquals("\"somePath\"", $variable->getValue());
64 }
65
66 public function testToString()
67 {
68 $variable = new ilSystemStyleLessVariable("name", "value", "comment", "category_name", ["references_id"]);
69 $this->assertEquals("//** comment\n@name:\t\tvalue;\n", (string) $variable);
70 }
71}
An exception for terminatinating execution or to throw for unit testing.