19use PHPUnit\Framework\TestCase;
27 $this->assertNull($state->getValueFor(
'invalid_key'));
31 #[\PHPUnit\Framework\Attributes\Depends('testGetNullValue')]
37 $this->assertEquals($value, $state->
getValueFor($key));
41 #[\PHPUnit\Framework\Attributes\Depends('testValue')]
44 $expected = json_encode([
'key' =>
'value'], JSON_THROW_ON_ERROR);
45 $this->assertEquals($expected, $state->
serialize());
48 #[\PHPUnit\Framework\Attributes\Depends('testValue')]
53 $expected = json_encode([
'keep' =>
'this'], JSON_THROW_ON_ERROR);
54 $this->assertEquals($expected, $state->
serialize());
Keeps the state of a view in a simple stringly type key-value store.
withValueFor(string $key, string $value)
Set a value for a key of the state.
withoutKey(string $key)
Remove the key-value-pair.
serialize()
Get the key-value store as string.
getValueFor(string $key)
Get the value for the given key.
testRemoveValue(State $state)
testSerialize(State $state)