ILIAS  release_6 Revision v6.24-5-g0c8bfefb3b8
MetaDataTest.php
Go to the documentation of this file.
1<?php
2
4
5use PHPUnit\Framework\TestCase;
11
12require_once('./libs/composer/vendor/autoload.php');
13
19class MetaDataTest extends TestCase
20{
25
26 protected function setUp() : void
27 {
28 parent::setUp();
29 $this->meta_content = new MetaContent('1.0');
30 }
31
32 public function testAddMetaDatum() : void
33 {
34 $key = 'key';
35 $value = 'value';
36 $this->meta_content->addMetaDatum($key, $value);
37 $collection = $this->meta_content->getMetaData();
38
39 $first_item = iterator_to_array($collection->getItems())[0];
40 $this->assertInstanceOf(MetaDatum::class, $first_item);
41 $this->assertEquals($key, $first_item->getKey());
42 $this->assertEquals($value, $first_item->getValue());
43 }
44
45}
An exception for terminatinating execution or to throw for unit testing.