ILIAS  release_8 Revision v8.19
All Data Structures Namespaces Files Functions Variables Modules Pages
ilSkinStyleLessVariableTest.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 class ilSkinStyleLessVariableTest extends TestCase
26 {
27  public function testConstruct(): void
28  {
29  $variable = new ilSystemStyleLessVariable('name', 'value', 'comment', 'category_name', ['references_id']);
30  $this->assertEquals('name', $variable->getName());
31  $this->assertEquals('value', $variable->getValue());
32  $this->assertEquals('comment', $variable->getComment());
33  $this->assertEquals('category_name', $variable->getCategoryName());
34  $this->assertEquals(['references_id'], $variable->getReferences());
35  }
36 
37  public function testSetters(): void
38  {
39  $variable = new ilSystemStyleLessVariable('name', 'value', 'comment', 'category_name', ['references_id']);
40 
41  $variable->setName('newName');
42  $variable->setValue('newValue');
43  $variable->setComment('newComment');
44  $variable->setCategoryName('new_category_name');
45  $variable->setReferences(['new_references_id']);
46 
47  $this->assertEquals('newName', $variable->getName());
48  $this->assertEquals('newValue', $variable->getValue());
49  $this->assertEquals('newComment', $variable->getComment());
50  $this->assertEquals('new_category_name', $variable->getCategoryName());
51  $this->assertEquals(['new_references_id'], $variable->getReferences());
52  }
53 
54  public function testIconFontPathUpdate(): void
55  {
56  $variable = new ilSystemStyleLessVariable('il-icon-font-path', 'value', 'comment', 'category_name', ['references_id']);
57 
58  $variable->setValue("\"../../node_modules/bootstrap/fonts/\"");
59  $this->assertEquals("\"../../../../node_modules/bootstrap/fonts/\"", $variable->getValue());
60  }
61 
62  public function testIconFontPathQuotation(): void
63  {
64  $variable = new ilSystemStyleLessVariable('il-icon-font-path', 'value', 'comment', 'category_name', ['references_id']);
65 
66  $variable->setValue("\"somePath\"");
67  $this->assertEquals("\"somePath\"", $variable->getValue());
68 
69  $variable->setValue('somePath');
70  $this->assertEquals("\"somePath\"", $variable->getValue());
71 
72 
73  $variable->setValue("\"somePath");
74  $this->assertEquals("\"somePath\"", $variable->getValue());
75 
76 
77  $variable->setValue("somePath\"");
78  $this->assertEquals("\"somePath\"", $variable->getValue());
79  }
80 
81  public function testToString(): void
82  {
83  $variable = new ilSystemStyleLessVariable('name', 'value', 'comment', 'category_name', ['references_id']);
84  $this->assertEquals("//** comment\n@name:\t\tvalue;\n", (string) $variable);
85  }
86 }