ILIAS  release_8 Revision v8.19-1-g4e8f2f9140c
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.

10  : State
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:12

◆ 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().

41  : void
42  {
43  $state = $state->withValueFor('keep', 'this');
44  $state = $state->withoutKey('key');
45  $expected = json_encode(['keep' => 'this'], JSON_THROW_ON_ERROR);
46  $this->assertEquals($expected, $state->serialize());
47  }
withValueFor(string $key, string $value)
Set a value for a key of the state.
Definition: State.php:22
serialize()
Get the key-value store as string.
Definition: State.php:53
withoutKey(string $key)
Remove the key-value-pair.
Definition: State.php:32
+ 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().

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

◆ testValue()

StateTest::testValue ( State  $state)

testGetNullValue

Definition at line 20 of file StateTest.php.

References ILIAS\LTI\ToolProvider\$key, ILIAS\KioskMode\State\getValueFor(), and ILIAS\KioskMode\State\withValueFor().

20  : State
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:22
getValueFor(string $key)
Get the value for the given key.
Definition: State.php:42
Keeps the state of a view in a simple stringly type key-value store.
Definition: State.php:12
string $key
Consumer key/client ID value.
Definition: System.php:193
+ Here is the call graph for this function:

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