ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
SettingTest.php
Go to the documentation of this file.
1<?php
2
19declare(strict_types=1);
20
22
23use PHPUnit\Framework\TestCase;
25use stdClass;
26
27class SettingTest extends TestCase
28{
29 public function testConstruct(): void
30 {
31 $this->assertInstanceOf(Setting::class, new Setting($this->fail(...), $this->fail(...)));
32 }
33
34 public function testValue(): void
35 {
36 $value = new stdClass();
37 $instance = new Setting(fn() => $value, $this->fail(...));
38 $this->assertSame($value, $instance->value());
39 }
40
41 public function testUpdate(): void
42 {
43 $value = new stdClass();
44
45 $instance = new Setting($this->fail(...), function ($x) use (&$called, $value): void {
46 $called = true;
47 $this->assertSame($value, $x);
48 });
49
50 $instance->update($value);
51 $this->assertTrue($called);
52 }
53}