ILIAS  trunk Revision v11.0_alpha-1843-g9e1fad99175
All Data Structures Namespaces Files Functions Variables Enumerations Enumerator Modules Pages
SlateTest Class Reference

Tests for the Slate. More...

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

Public Member Functions

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

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)

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)

testConstruction

Definition at line 114 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().

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  }
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)

testConstruction

Definition at line 88 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().

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

testConstruction

Definition at line 101 of file SlateTest.php.

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

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  }
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)

testConstruction

Definition at line 79 of file SlateTest.php.

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

79  : void
80  {
81  $slate = $slate->withEngaged(true);
82  $this->assertTrue($slate->getEngaged());
83  }
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: