ILIAS  release_8 Revision v8.24
SlateTest Class Reference

Tests for the Slate. More...

+ Inheritance diagram for SlateTest:
+ Collaboration diagram for SlateTest:

Public Member Functions

 setUp ()
 
 testConstruction ()
 
 testWithEngaged (Slate $slate)
 @depends testConstruction More...
 
 testWithAriaRole (Slate $slate)
 @depends testConstruction More...
 
 testWithAriaRoleIncorrect (Slate $slate)
 @depends testConstruction More...
 
 testSignals (Slate $slate)
 @depends testConstruction More...
 
 testDifferentSignals (array $signals)
 @depends testSignals More...
 
- Public Member Functions inherited from ILIAS_UI_TestBase
 setUp ()
 
 tearDown ()
 
 getUIFactory ()
 
 getTemplateFactory ()
 
 getResourceRegistry ()
 
 getLanguage ()
 
 getJavaScriptBinding ()
 
 getRefinery ()
 
 getImagePathResolver ()
 
 getDataFactory ()
 
 getDefaultRenderer (JavaScriptBinding $js_binding=null, array $with_stub_renderings=[])
 
 getDecoratedRenderer (Renderer $default)
 
 normalizeHTML (string $html)
 
 assertHTMLEquals (string $expected_html_as_string, string $html_as_string)
 

Protected Attributes

I SignalGenerator $sig_gen
 
I Button Factory $button_factory
 
I Symbol Icon Factory $icon_factory
 

Additional Inherited Members

- Protected Member Functions inherited from ILIAS_UI_TestBase
 brutallyTrimHTML (string $html)
 A more radical version of normalizeHTML. More...
 
 brutallyTrimSignals (string $html)
 A naive replacement of all il_signal-ids with dots to ease comparisons of rendered output. More...
 

Detailed Description

Tests for the Slate.

Definition at line 47 of file SlateTest.php.

Member Function Documentation

◆ setUp()

SlateTest::setUp ( )

Reimplemented from ILIAS_UI_TestBase.

Definition at line 53 of file SlateTest.php.

53 : void
54 {
55 $this->sig_gen = new I\SignalGenerator();
56 $this->button_factory = new I\Button\Factory();
57 $this->icon_factory = new I\Symbol\Icon\Factory();
58 }

◆ testConstruction()

SlateTest::testConstruction ( )

Definition at line 60 of file SlateTest.php.

61 {
62 $name = 'name';
63 $icon = $this->icon_factory->custom('', '');
64 $slate = new TestGenericSlate($this->sig_gen, $name, $icon);
65
66 $this->assertInstanceOf(
67 "ILIAS\\UI\\Component\\MainControls\\Slate\\Slate",
68 $slate
69 );
70 $this->assertEquals($name, $slate->getName());
71 $this->assertEquals($icon, $slate->getSymbol());
72 $this->assertFalse($slate->getEngaged());
73 return $slate;
74 }
A generic Slate.
Definition: SlateTest.php:33
if($format !==null) $name
Definition: metadata.php:247

References $name.

◆ testDifferentSignals()

SlateTest::testDifferentSignals ( array  $signals)

@depends testSignals

Definition at line 130 of file SlateTest.php.

130 : void
131 {
132 $this->assertEquals(
133 $signals,
134 array_unique($signals)
135 );
136 }

◆ testSignals()

SlateTest::testSignals ( Slate  $slate)

@depends testConstruction

Definition at line 114 of file SlateTest.php.

114 : array
115 {
116 $signals = [
117 $slate->getToggleSignal(),
118 $slate->getEngageSignal(),
119 $slate->getReplaceSignal()
120 ];
121 foreach ($signals as $signal) {
122 $this->assertInstanceOf(Signal::class, $signal);
123 }
124 return $signals;
125 }

References ILIAS\UI\Implementation\Component\MainControls\Slate\Slate\getEngageSignal(), ILIAS\UI\Implementation\Component\MainControls\Slate\Slate\getReplaceSignal(), and ILIAS\UI\Implementation\Component\MainControls\Slate\Slate\getToggleSignal().

+ Here is the call graph for this function:

◆ testWithAriaRole()

SlateTest::testWithAriaRole ( Slate  $slate)

@depends testConstruction

Definition at line 88 of file SlateTest.php.

88 : void
89 {
90 try {
91 $slate = $slate->withAriaRole(Slate::MENU);
92 $this->assertEquals("menu", $slate->getAriaRole());
93 } catch (InvalidArgumentException $e) {
94 $this->assertFalse("This should not happen");
95 }
96 }
getAriaRole()
Get the ARIA role on the slate.
Definition: Slate.php:199
withAriaRole(string $aria_role)
Get a slate like this, but with an additional ARIA role.
Definition: Slate.php:183

References Vendor\Package\$e, ILIAS\UI\Implementation\Component\MainControls\Slate\Slate\getAriaRole(), and ILIAS\UI\Implementation\Component\MainControls\Slate\Slate\withAriaRole().

+ Here is the call graph for this function:

◆ testWithAriaRoleIncorrect()

SlateTest::testWithAriaRoleIncorrect ( Slate  $slate)

@depends testConstruction

Definition at line 101 of file SlateTest.php.

101 : void
102 {
103 try {
104 $slate->withAriaRole("loremipsum");
105 $this->assertFalse("This should not happen");
106 } catch (InvalidArgumentException $e) {
107 $this->assertTrue(true);
108 }
109 }

References Vendor\Package\$e, and ILIAS\UI\Implementation\Component\MainControls\Slate\Slate\withAriaRole().

+ Here is the call graph for this function:

◆ testWithEngaged()

SlateTest::testWithEngaged ( Slate  $slate)

@depends testConstruction

Definition at line 79 of file SlateTest.php.

79 : void
80 {
81 $slate = $slate->withEngaged(true);
82 $this->assertTrue($slate->getEngaged());
83 }

References ILIAS\UI\Implementation\Component\MainControls\Slate\Slate\getEngaged(), and ILIAS\UI\Implementation\Component\MainControls\Slate\Slate\withEngaged().

+ Here is the call graph for this function:

Field Documentation

◆ $button_factory

I Button Factory SlateTest::$button_factory
protected

Definition at line 50 of file SlateTest.php.

◆ $icon_factory

I Symbol Icon Factory SlateTest::$icon_factory
protected

Definition at line 51 of file SlateTest.php.

◆ $sig_gen

I SignalGenerator SlateTest::$sig_gen
protected

Definition at line 49 of file SlateTest.php.


The documentation for this class was generated from the following file: