ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
DataFactoryTest.php
Go to the documentation of this file.
1<?php
2
19declare(strict_types=1);
20
22
23use PHPUnit\Framework\TestCase;
25
26class DataFactoryTest extends TestCase
27{
28 public function testCreateData(): void
29 {
30 $factory = new DataFactory();
31 $data = $factory->data(Type::VOCAB_VALUE, 'value');
32
33 $this->assertInstanceOf(DataInterface::class, $data);
34 }
35
36 public function testCreateDataSlotNotNull(): void
37 {
38 $factory = new DataFactory();
39 $data = $factory->data(
40 Type::VOCAB_VALUE,
41 'value',
42 SlotIdentifier::CLASSIFICATION_PURPOSE
43 );
44
45 $this->assertInstanceOf(DataInterface::class, $data);
46 }
47
48 public function testCreateNullData(): void
49 {
50 $factory = new DataFactory();
51 $null_data = $factory->null();
52
53 $this->assertInstanceOf(DataInterface::class, $null_data);
54 $this->assertSame(Type::NULL, $null_data->type());
55 }
56}