ILIAS
trunk Revision v11.0_alpha-2662-g519ff7d528f
◀ ilDoc Overview
UserPreferenceStoreTest.php
Go to the documentation of this file.
1
<?php
2
19
declare(strict_types=1);
20
21
namespace
ILIAS\LegalDocuments\test\ConsumerToolbox\KeyValueStore
;
22
23
use
ILIAS\LegalDocuments\test\ContainerMock
;
24
use
ilObjUser
;
25
use
ILIAS\LegalDocuments\ConsumerToolbox\KeyValueStore\UserPreferenceStore
;
26
use
PHPUnit\Framework\TestCase
;
27
28
require_once __DIR__ .
'/../../ContainerMock.php'
;
29
30
class
UserPreferenceStoreTest
extends
TestCase
31
{
32
use
ContainerMock
;
33
34
public
function
testConstruct
(): void
35
{
36
$this->assertInstanceOf(UserPreferenceStore::class,
new
UserPreferenceStore
($this->mock(ilObjUser::class)));
37
}
38
39
public
function
testValue
(): void
40
{
41
$this->assertSame(
'bar'
, (
new
UserPreferenceStore
($this->mockMethod(ilObjUser::class,
'getPref'
, [
'foo'
],
'bar'
)))->
value
(
'foo'
));
42
}
43
44
public
function
testNullValue
(): void
45
{
46
$this->assertSame(
''
, (
new
UserPreferenceStore
($this->mockMethod(ilObjUser::class,
'getPref'
, [
'foo'
],
null
)))->
value
(
'foo'
));
47
}
48
49
public
function
testUpdate
(): void
50
{
51
$user = $this->mock(ilObjUser::class);
52
$user->expects(self::once())->method(
'writePref'
)->with(
'foo'
,
'bar'
);
53
54
(
new
UserPreferenceStore
($user))->
update
(
'foo'
,
'bar'
);
55
}
56
}
ILIAS\LegalDocuments\test\ConsumerToolbox\KeyValueStore\UserPreferenceStoreTest
Definition:
UserPreferenceStoreTest.php:30
ContainerMock
ILIAS\LegalDocuments\ConsumerToolbox\KeyValueStore\value
value(string $name)
ILIAS\LegalDocuments\test\ConsumerToolbox\KeyValueStore\UserPreferenceStoreTest\testUpdate
testUpdate()
Definition:
UserPreferenceStoreTest.php:49
ILIAS\LegalDocuments\test\ConsumerToolbox\KeyValueStore\UserPreferenceStoreTest\testValue
testValue()
Definition:
UserPreferenceStoreTest.php:39
null
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
Definition:
shib_logout.php:144
ILIAS\LegalDocuments\test\ConsumerToolbox\KeyValueStore\UserPreferenceStoreTest\testConstruct
testConstruct()
Definition:
UserPreferenceStoreTest.php:34
ilObjUser
ILIAS\LegalDocuments\ConsumerToolbox\KeyValueStore\UserPreferenceStore
Definition:
UserPreferenceStore.php:26
ContainerMock
ILIAS\LegalDocuments\test\ConsumerToolbox\KeyValueStore\UserPreferenceStoreTest\testNullValue
testNullValue()
Definition:
UserPreferenceStoreTest.php:44
UserPreferenceStore
ILIAS\LegalDocuments\test\ConsumerToolbox\KeyValueStore
Definition:
ILIASSettingStoreTest.php:21
TestCase
ILIAS\LegalDocuments\ConsumerToolbox\KeyValueStore\update
update(string $name, string $value)
components
ILIAS
LegalDocuments
tests
ConsumerToolbox
KeyValueStore
UserPreferenceStoreTest.php
Generated on Wed Sep 3 2025 23:03:20 for ILIAS by
1.8.13 (using
Doxyfile
)