ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
TypeSpecificDataTest.php
Go to the documentation of this file.
1<?php
2
19declare(strict_types=1);
20
22
23use PHPUnit\Framework\TestCase;
25
26class TypeSpecificDataTest extends TestCase
27{
28 protected function getData(?int $field_id = null): TypeSpecificDataImplementation
29 {
30 return new class ($field_id) extends TypeSpecificDataImplementation {
31 public function isTypeSupported(Type $type): bool
32 {
33 return true;
34 }
35
36 protected function getSubData(): \Generator
37 {
38 yield from [];
39 }
40 };
41 }
42
43 public function testIsPersistedTrue(): void
44 {
45 $data = $this->getData(7);
46 $this->assertTrue($data->isPersisted());
47 }
48
49 public function testIsPersistedFalse(): void
50 {
51 $data = $this->getData();
52 $this->assertFalse($data->isPersisted());
53 }
54}