ILIAS  trunk Revision v11.0_alpha-2658-ge2404539063
ILIAS\GlobalScreen\Scope\Layout\MetaDataTest Class Reference

Class MetaDataTest. More...

+ Inheritance diagram for ILIAS\GlobalScreen\Scope\Layout\MetaDataTest:
+ Collaboration diagram for ILIAS\GlobalScreen\Scope\Layout\MetaDataTest:

Public Member Functions

 testAddMetaDatum ()
 
 testAddMetaDatumWithDuplicate ()
 
 getMockedTag (string $html)
 

Data Fields

MetaContent $meta_content
 

Protected Member Functions

 setUp ()
 

Detailed Description

Class MetaDataTest.

Author
Fabian Schmid fs@st.nosp@m.uder.nosp@m.-raim.nosp@m.ann..nosp@m.ch

Definition at line 35 of file MetaDataTest.php.

Member Function Documentation

◆ getMockedTag()

ILIAS\GlobalScreen\Scope\Layout\MetaDataTest::getMockedTag ( string  $html)

Definition at line 79 of file MetaDataTest.php.

References ILIAS\__construct().

Referenced by ILIAS\GlobalScreen\Scope\Layout\MetaDataTest\testAddMetaDatum().

79  : Tag
80  {
81  return new class ($html) extends Tag {
82  public function __construct(
83  protected string $html
84  ) {
85  }
86 
87  public function toHtml(): string
88  {
89  return $this->html;
90  }
91  };
92  }
__construct()
Constructor setup ILIAS global object public.
Definition: class.ilias.php:76
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ setUp()

ILIAS\GlobalScreen\Scope\Layout\MetaDataTest::setUp ( )
protected

Definition at line 39 of file MetaDataTest.php.

39  : void
40  {
41  parent::setUp();
42  $this->meta_content = new MetaContent('1.0');
43  }

◆ testAddMetaDatum()

ILIAS\GlobalScreen\Scope\Layout\MetaDataTest::testAddMetaDatum ( )

Definition at line 45 of file MetaDataTest.php.

References ILIAS\GlobalScreen\Scope\Layout\MetaDataTest\getMockedTag().

45  : void
46  {
47  $html = "test_html";
48  $html_meta_data = $this->getMockedTag($html);
49  $this->meta_content->addMetaDatum($html_meta_data);
50  $collection = $this->meta_content->getMetaData();
51 
52  $first_item = $collection[0];
53  $this->assertInstanceOf(Tag::class, $first_item);
54  $this->assertSame($html, $first_item->toHtml());
55  }
+ Here is the call graph for this function:

◆ testAddMetaDatumWithDuplicate()

ILIAS\GlobalScreen\Scope\Layout\MetaDataTest::testAddMetaDatumWithDuplicate ( )

Definition at line 57 of file MetaDataTest.php.

57  : void
58  {
59  $meta_datum_key = 'key';
60  $meta_datum_1_value = 'value_1';
61  $meta_datum_2_value = 'value_2';
62  $meta_datum_1 = new UserDefined($meta_datum_key, $meta_datum_1_value);
63  $meta_datum_2 = new UserDefined($meta_datum_key, $meta_datum_2_value);
64 
65  $this->meta_content->addMetaDatum($meta_datum_1);
66  $first_item = $this->meta_content->getMetaData()[$meta_datum_key];
67 
68  $this->assertInstanceOf(UserDefined::class, $first_item);
69  $this->assertSame($meta_datum_1_value, $first_item->getValue());
70 
71  $this->meta_content->addMetaDatum($meta_datum_2);
72  $first_item = $this->meta_content->getMetaData()[$meta_datum_key];
73 
74  $this->assertInstanceOf(UserDefined::class, $first_item);
75  $this->assertNotSame($meta_datum_1_value, $first_item->getValue());
76  $this->assertSame($meta_datum_2_value, $first_item->getValue());
77  }

Field Documentation

◆ $meta_content

MetaContent ILIAS\GlobalScreen\Scope\Layout\MetaDataTest::$meta_content

Definition at line 37 of file MetaDataTest.php.


The documentation for this class was generated from the following file: