ILIAS  release_6 Revision v6.24-5-g0c8bfefb3b8
StateTest Class Reference
+ Inheritance diagram for StateTest:
+ Collaboration diagram for StateTest:

Public Member Functions

 testGetNullValue ()
 
 testValue (State $state)
 @depends testGetNullValue More...
 
 testSerialize (State $state)
 @depends testValue More...
 
 testRemoveValue (State $state)
 @depends testValue More...
 

Detailed Description

Definition at line 8 of file StateTest.php.

Member Function Documentation

◆ testGetNullValue()

StateTest::testGetNullValue ( )

Definition at line 10 of file StateTest.php.

11 {
12 $state = new State();
13 $this->assertNull($state->getValueFor('invalid_key'));
14 return $state;
15 }
Keeps the state of a view in a simple stringly type key-value store.
Definition: State.php:10

◆ testRemoveValue()

StateTest::testRemoveValue ( State  $state)

@depends testValue

Definition at line 41 of file StateTest.php.

42 {
43 $state = $state->withValueFor('keep', 'this');
44 $state = $state->withoutKey('key');
45 $expected = json_encode(['keep' => 'this']);
46 $this->assertEquals($expected, $state->serialize());
47 }
withValueFor(string $key, string $value)
Set a value for a key of the state.
Definition: State.php:20
withoutKey(string $key)
Remove the key-value-pair.
Definition: State.php:30
serialize()
Get the key-value store as string.
Definition: State.php:51

References ILIAS\KioskMode\State\serialize(), ILIAS\KioskMode\State\withoutKey(), and ILIAS\KioskMode\State\withValueFor().

+ Here is the call graph for this function:

◆ testSerialize()

StateTest::testSerialize ( State  $state)

@depends testValue

Definition at line 32 of file StateTest.php.

33 {
34 $expected = json_encode(['key' => 'value']);
35 $this->assertEquals($expected, $state->serialize());
36 }

References ILIAS\KioskMode\State\serialize().

+ Here is the call graph for this function:

◆ testValue()

StateTest::testValue ( State  $state)

@depends testGetNullValue

Definition at line 20 of file StateTest.php.

21 {
22 $key = 'key';
23 $value = 'value';
24 $state = $state->withValueFor($key, $value);
25 $this->assertEquals($value, $state->getValueFor($key));
26 return $state;
27 }
getValueFor(string $key)
Get the value for the given key.
Definition: State.php:40

References ILIAS\KioskMode\State\getValueFor(), and ILIAS\KioskMode\State\withValueFor().

+ Here is the call graph for this function:

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