ILIAS  release_6 Revision v6.24-5-g0c8bfefb3b8
All Data Structures Namespaces Files Functions Variables Modules Pages
StateTest Class Reference
+ Inheritance diagram for StateTest:
+ Collaboration diagram for StateTest:

Public Member Functions

 testGetNullValue ()
 
 testValue (State $state)
 testGetNullValue More...
 
 testSerialize (State $state)
 testValue More...
 
 testRemoveValue (State $state)
 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:9

◆ testRemoveValue()

StateTest::testRemoveValue ( State  $state)

testValue

Definition at line 41 of file StateTest.php.

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

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
serialize()
Get the key-value store as string.
Definition: State.php:51
withoutKey(string $key)
Remove the key-value-pair.
Definition: State.php:30
+ Here is the call graph for this function:

◆ testSerialize()

StateTest::testSerialize ( State  $state)

testValue

Definition at line 32 of file StateTest.php.

References ILIAS\KioskMode\State\serialize().

33  {
34  $expected = json_encode(['key' => 'value']);
35  $this->assertEquals($expected, $state->serialize());
36  }
serialize()
Get the key-value store as string.
Definition: State.php:51
+ Here is the call graph for this function:

◆ testValue()

StateTest::testValue ( State  $state)

testGetNullValue

Definition at line 20 of file StateTest.php.

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

21  {
22  $key = 'key';
23  $value = 'value';
24  $state = $state->withValueFor($key, $value);
25  $this->assertEquals($value, $state->getValueFor($key));
26  return $state;
27  }
withValueFor(string $key, string $value)
Set a value for a key of the state.
Definition: State.php:20
getValueFor(string $key)
Get the value for the given key.
Definition: State.php:40
+ Here is the call graph for this function:

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