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