ILIAS  trunk Revision v11.0_alpha-1715-g7fc467680fb
All Data Structures Namespaces Files Functions Variables Enumerations Enumerator 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 22 of file StateTest.php.

Member Function Documentation

◆ testGetNullValue()

StateTest::testGetNullValue ( )

Definition at line 24 of file StateTest.php.

24  : State
25  {
26  $state = new State();
27  $this->assertNull($state->getValueFor('invalid_key'));
28  return $state;
29  }
Keeps the state of a view in a simple stringly type key-value store.
Definition: State.php:26

◆ testRemoveValue()

StateTest::testRemoveValue ( State  $state)

testValue

Definition at line 55 of file StateTest.php.

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

55  : void
56  {
57  $state = $state->withValueFor('keep', 'this');
58  $state = $state->withoutKey('key');
59  $expected = json_encode(['keep' => 'this'], JSON_THROW_ON_ERROR);
60  $this->assertEquals($expected, $state->serialize());
61  }
withValueFor(string $key, string $value)
Set a value for a key of the state.
Definition: State.php:36
serialize()
Get the key-value store as string.
Definition: State.php:67
withoutKey(string $key)
Remove the key-value-pair.
Definition: State.php:46
+ Here is the call graph for this function:

◆ testSerialize()

StateTest::testSerialize ( State  $state)

testValue

Definition at line 46 of file StateTest.php.

References ILIAS\KioskMode\State\serialize().

46  : void
47  {
48  $expected = json_encode(['key' => 'value'], JSON_THROW_ON_ERROR);
49  $this->assertEquals($expected, $state->serialize());
50  }
serialize()
Get the key-value store as string.
Definition: State.php:67
+ Here is the call graph for this function:

◆ testValue()

StateTest::testValue ( State  $state)

testGetNullValue

Definition at line 34 of file StateTest.php.

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

34  : State
35  {
36  $key = 'key';
37  $value = 'value';
38  $state = $state->withValueFor($key, $value);
39  $this->assertEquals($value, $state->getValueFor($key));
40  return $state;
41  }
withValueFor(string $key, string $value)
Set a value for a key of the state.
Definition: State.php:36
getValueFor(string $key)
Get the value for the given key.
Definition: State.php:56
Keeps the state of a view in a simple stringly type key-value store.
Definition: State.php:26
+ Here is the call graph for this function:

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