ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
ReadOnlyStoreTest.php
Go to the documentation of this file.
1<?php
2
19declare(strict_types=1);
20
22
23use ILIAS\LegalDocuments\test\ContainerMock;
26use PHPUnit\Framework\TestCase;
27use Exception;
28
29require_once __DIR__ . '/../../ContainerMock.php';
30
31class ReadOnlyStoreTest extends TestCase
32{
33 use ContainerMock;
34
35 public function testConstruct(): void
36 {
37 $this->assertInstanceOf(ReadOnlyStore::class, new ReadOnlyStore($this->mock(KeyValueStore::class)));
38 }
39
40 public function testValue(): void
41 {
42 $instance = new ReadOnlyStore($this->mockMethod(KeyValueStore::class, 'value', ['foo'], 'bar'));
43
44 $this->assertSame('bar', $instance->value('foo'));
45 }
46
47 public function testUpdate(): void
48 {
49 $this->expectException(Exception::class);
50
51 $instance = new ReadOnlyStore($this->mock(KeyValueStore::class));
52 $instance->update('foo', 'bar');
53 }
54}