ILIAS  trunk Revision v11.0_alpha-2662-g519ff7d528f
SlateTest Class Reference

Tests for the Slate. More...

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

Public Member Functions

 setUp ()
 
 testConstruction ()
 
 testWithEngaged (Slate $slate)
 
 testWithAriaRole (Slate $slate)
 
 testWithAriaRoleIncorrect (Slate $slate)
 
 testSignals (Slate $slate)
 
 testDifferentSignals (array $signals)
 

Protected Attributes

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

Detailed Description

Tests for the Slate.

Definition at line 47 of file SlateTest.php.

Member Function Documentation

◆ setUp()

SlateTest::setUp ( )

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.

References ILIAS\UI\Implementation\Component\MainControls\Slate\Slate\$name.

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:32

◆ testDifferentSignals()

SlateTest::testDifferentSignals ( array  $signals)

Definition at line 120 of file SlateTest.php.

120  : void
121  {
122  $this->assertEquals(
123  $signals,
124  array_unique($signals)
125  );
126  }

◆ testSignals()

SlateTest::testSignals ( Slate  $slate)

Definition at line 106 of file SlateTest.php.

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().

106  : array
107  {
108  $signals = [
109  $slate->getToggleSignal(),
110  $slate->getEngageSignal(),
111  $slate->getReplaceSignal()
112  ];
113  foreach ($signals as $signal) {
114  $this->assertInstanceOf(Signal::class, $signal);
115  }
116  return $signals;
117  }
getReplaceSignal()
Signal to replace the contents of the slate.
Definition: Slate.php:145
getEngageSignal()
Signal that engages the slate when triggered.
Definition: Slate.php:114
getToggleSignal()
Signal that toggles the slate when triggered.
Definition: Slate.php:106
+ Here is the call graph for this function:

◆ testWithAriaRole()

SlateTest::testWithAriaRole ( Slate  $slate)

Definition at line 84 of file SlateTest.php.

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

84  : void
85  {
86  try {
87  $slate = $slate->withAriaRole(Slate::MENU);
88  $this->assertEquals("menu", $slate->getAriaRole());
89  } catch (InvalidArgumentException $e) {
90  $this->assertFalse("This should not happen");
91  }
92  }
getAriaRole()
Get the ARIA role on the slate.
Definition: Slate.php:201
withAriaRole(string $aria_role)
Get a slate like this, but with an additional ARIA role.
Definition: Slate.php:185
+ Here is the call graph for this function:

◆ testWithAriaRoleIncorrect()

SlateTest::testWithAriaRoleIncorrect ( Slate  $slate)

Definition at line 95 of file SlateTest.php.

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

95  : void
96  {
97  try {
98  $slate->withAriaRole("loremipsum");
99  $this->assertFalse("This should not happen");
100  } catch (InvalidArgumentException $e) {
101  $this->assertTrue(true);
102  }
103  }
withAriaRole(string $aria_role)
Get a slate like this, but with an additional ARIA role.
Definition: Slate.php:185
+ Here is the call graph for this function:

◆ testWithEngaged()

SlateTest::testWithEngaged ( Slate  $slate)

Definition at line 77 of file SlateTest.php.

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

77  : void
78  {
79  $slate = $slate->withEngaged(true);
80  $this->assertTrue($slate->getEngaged());
81  }
getEngaged()
Should the slate be rendered as engaged?
Definition: Slate.php:132
withEngaged(bool $state)
Configures the slate to be rendered as engaged (or not).
Definition: Slate.php:122
+ 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: