ILIAS  release_7 Revision v7.30-3-g800a261c036
MetaDataTest.php
Go to the documentation of this file.
1<?php
2
20
21use PHPUnit\Framework\TestCase;
24
25require_once('./libs/composer/vendor/autoload.php');
26
32class MetaDataTest extends TestCase
33{
38
39 protected function setUp() : void
40 {
41 parent::setUp();
42 $this->meta_content = new MetaContent('1.0');
43 }
44
45 public function testAddMetaDatum() : void
46 {
47 $key = 'key';
48 $value = 'value';
49 $this->meta_content->addMetaDatum($key, $value);
50 $collection = $this->meta_content->getMetaData();
51
52 $first_item = iterator_to_array($collection->getItems())[0];
53 $this->assertInstanceOf(MetaDatum::class, $first_item);
54 $this->assertEquals($key, $first_item->getKey());
55 $this->assertEquals($value, $first_item->getValue());
56 }
57}
An exception for terminatinating execution or to throw for unit testing.
@noinspection PhpIncompatibleReturnTypeInspection