ILIAS  trunk Revision v11.0_alpha-2645-g16283d3b3f8
StateTest Class Reference
+ Inheritance diagram for StateTest:
+ Collaboration diagram for StateTest:

Public Member Functions

 testGetNullValue ()
 
 testValue (State $state)
 
 testSerialize (State $state)
 
 testRemoveValue (State $state)
 

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  }

◆ testRemoveValue()

StateTest::testRemoveValue ( State  $state)

Definition at line 49 of file StateTest.php.

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

49  : void
50  {
51  $state = $state->withValueFor('keep', 'this');
52  $state = $state->withoutKey('key');
53  $expected = json_encode(['keep' => 'this'], JSON_THROW_ON_ERROR);
54  $this->assertEquals($expected, $state->serialize());
55  }
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)

Definition at line 42 of file StateTest.php.

References ILIAS\KioskMode\State\serialize().

42  : void
43  {
44  $expected = json_encode(['key' => 'value'], JSON_THROW_ON_ERROR);
45  $this->assertEquals($expected, $state->serialize());
46  }
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)

Definition at line 32 of file StateTest.php.

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

32  : State
33  {
34  $key = 'key';
35  $value = 'value';
36  $state = $state->withValueFor($key, $value);
37  $this->assertEquals($value, $state->getValueFor($key));
38  return $state;
39  }
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
+ Here is the call graph for this function:

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