ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
ILIAS\LegalDocuments\test\ConsumerToolbox\SelectSettingTest Class Reference
+ Inheritance diagram for ILIAS\LegalDocuments\test\ConsumerToolbox\SelectSettingTest:
+ Collaboration diagram for ILIAS\LegalDocuments\test\ConsumerToolbox\SelectSettingTest:

Public Member Functions

 testConstruct ()
 
 testTyped ()
 

Detailed Description

Definition at line 34 of file SelectSettingTest.php.

Member Function Documentation

◆ testConstruct()

ILIAS\LegalDocuments\test\ConsumerToolbox\SelectSettingTest::testConstruct ( )

Definition at line 38 of file SelectSettingTest.php.

38 : void
39 {
40 $this->assertInstanceOf(SelectSetting::class, new SelectSetting($this->mock(KeyValueStore::class), $this->mock(Marshal::class)));
41 }

◆ testTyped()

ILIAS\LegalDocuments\test\ConsumerToolbox\SelectSettingTest::testTyped ( )

Definition at line 43 of file SelectSettingTest.php.

43 : void
44 {
45 $read_value = 'a value';
46 $write_value = 'some value';
47 $set_value = new stdClass();
48 $value = new stdClass();
49
50 $marshal = $this->mock(Marshal::class);
51 $convert = $this->mockTree(Convert::class, [
52 'fromString' => $this->mockMethod(Transformation::class, 'transform', [$read_value], $value),
53 'toString' => $this->mockMethod(Transformation::class, 'transform', [$set_value], $write_value),
54 ]);
55
56 $store = $this->mock(KeyValueStore::class);
57 $store->expects(self::once())->method('value')->with('foo')->willReturn($read_value);
58 $store->expects(self::once())->method('update')->with('foo', $write_value);
59
60 $instance = new SelectSetting($store, $marshal);
61 $setting = $instance->typed('foo', function (Marshal $m) use ($marshal, $convert): Convert {
62 $this->assertSame($marshal, $m);
63 return $convert;
64 });
65
66 $this->assertSame($value, $setting->value());
67 $setting->update($set_value);
68 }
ilSetting $setting
Definition: class.ilias.php:68

References ILIAS\$setting.


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