ILIAS  trunk Revision v11.0_alpha-2662-g519ff7d528f
EntityTest Class Reference
+ Inheritance diagram for EntityTest:
+ Collaboration diagram for EntityTest:

Public Member Functions

 testEntityFactory ()
 
 testEntityBasicProperties ()
 
 testEntityIdentifiers ($identifier)
 
 testEntityActionProperties ()
 
 testEntityComponentProperties ()
 
 getUIFactory ()
 
 testEntityRendering ()
 

Static Public Member Functions

static getEntityAllowedIdentiferTypes ()
 

Protected Member Functions

 getEntityFactory ()
 
 legacy (string $string)
 

Detailed Description

Definition at line 32 of file EntityTest.php.

Member Function Documentation

◆ getEntityAllowedIdentiferTypes()

static EntityTest::getEntityAllowedIdentiferTypes ( )
static

Definition at line 63 of file EntityTest.php.

63  : array
64  {
65  $shy_button = new Button\Shy('the label', '#');
66  $shy_link = new Link\Standard('the label', '#');
67  $image = new Image\Image(I\Image\Image::STANDARD, 'source', 'alt');
68  $icon = new Symbol\Icon\Standard('crs', 'label', 'large', false);
69  return [
70  [$shy_button],
71  [$shy_link],
72  [$image],
73  [$icon],
74  ['some string']
75  ];
76  }
This describes the specific behavior of an ILIAS standard icon.
Definition: Standard.php:26

◆ getEntityFactory()

EntityTest::getEntityFactory ( )
protected

Definition at line 34 of file EntityTest.php.

Referenced by testEntityActionProperties(), testEntityBasicProperties(), testEntityComponentProperties(), testEntityFactory(), testEntityIdentifiers(), and testEntityRendering().

35  {
36  return new Entity\Factory();
37  }
This is the factory for Entities.
Definition: Factory.php:31
+ Here is the caller graph for this function:

◆ getUIFactory()

EntityTest::getUIFactory ( )

Definition at line 117 of file EntityTest.php.

117  : NoUIFactory
118  {
119  return new class () extends NoUIFactory {
120  public function dropdown(): Dropdown\Factory
121  {
122  return new Dropdown\Factory();
123  }
124  };
125  }
Builds a Color from either hex- or rgb values.
Definition: Factory.php:30
This implements commonalities between different types of Dropdowns.
Definition: Dropdown.php:35

◆ legacy()

EntityTest::legacy ( string  $string)
protected

Definition at line 39 of file EntityTest.php.

Referenced by testEntityBasicProperties(), and testEntityRendering().

+ Here is the caller graph for this function:

◆ testEntityActionProperties()

EntityTest::testEntityActionProperties ( )

Definition at line 86 of file EntityTest.php.

References getEntityFactory().

86  : void
87  {
88  $glyph = new Symbol\Glyph\Glyph('laugh', 'some glyph');
89  $tag = new Button\Tag('tag', '#');
90  $shy = new Button\Shy('shy', '#');
91  $entity = $this->getEntityFactory()->standard('primary', 'secondary')
92  ->withPrioritizedReactions($glyph, $tag)
93  ->withReactions($glyph, $glyph, $glyph)
94  ->withActions($shy);
95 
96  $this->assertEquals([$glyph, $tag], $entity->getPrioritizedReactions());
97  $this->assertEquals([$glyph,$glyph,$glyph], $entity->getReactions());
98  $this->assertEquals([$shy], $entity->getActions());
99  }
getEntityFactory()
Definition: EntityTest.php:34
+ Here is the call graph for this function:

◆ testEntityBasicProperties()

EntityTest::testEntityBasicProperties ( )

Definition at line 52 of file EntityTest.php.

References getEntityFactory(), and legacy().

52  : void
53  {
54  $entity = $this->getEntityFactory()->standard('primary', 'secondary');
55  $this->assertEquals([$this->legacy('bc')], $entity->withBlockingAvailabilityConditions($this->legacy('bc'))->getBlockingAvailabilityConditions());
56  $this->assertEquals([$this->legacy('fp')], $entity->withFeaturedProperties($this->legacy('fp'))->getFeaturedProperties());
57  $this->assertEquals([$this->legacy('md')], $entity->withMainDetails($this->legacy('md'))->getMainDetails());
58  $this->assertEquals([$this->legacy('ps')], $entity->withPersonalStatus($this->legacy('ps'))->getPersonalStatus());
59  $this->assertEquals([$this->legacy('a')], $entity->withAvailability($this->legacy('a'))->getAvailability());
60  $this->assertEquals([$this->legacy('d')], $entity->withDetails($this->legacy('d'))->getDetails());
61  }
getEntityFactory()
Definition: EntityTest.php:34
legacy(string $string)
Definition: EntityTest.php:39
+ Here is the call graph for this function:

◆ testEntityComponentProperties()

EntityTest::testEntityComponentProperties ( )

Definition at line 101 of file EntityTest.php.

References getEntityFactory().

101  : void
102  {
103  $glyph = new Symbol\Glyph\Glyph('laugh', 'some glyph');
104  $tag = new Button\Tag('tag', '#');
105  $shy = new Button\Shy('shy', '#');
106  $entity = $this->getEntityFactory()->standard('primary', 'secondary')
107  ->withPrioritizedReactions($glyph, $tag)
108  ->withReactions($glyph)
109  ->withActions($shy);
110 
111  $this->assertEquals([$glyph, $tag], $entity->getPrioritizedReactions());
112  $this->assertEquals([$glyph], $entity->getReactions());
113  $this->assertEquals([$shy], $entity->getActions());
114  }
getEntityFactory()
Definition: EntityTest.php:34
+ Here is the call graph for this function:

◆ testEntityFactory()

EntityTest::testEntityFactory ( )

Definition at line 44 of file EntityTest.php.

References getEntityFactory().

44  : void
45  {
46  $entity = $this->getEntityFactory()->standard('primary', 'secondary');
47  $this->assertInstanceOf("ILIAS\\UI\\Component\\Entity\\Standard", $entity);
48  $this->assertEquals('primary', $entity->getPrimaryIdentifier());
49  $this->assertEquals('secondary', $entity->getSecondaryIdentifier());
50  }
getEntityFactory()
Definition: EntityTest.php:34
+ Here is the call graph for this function:

◆ testEntityIdentifiers()

EntityTest::testEntityIdentifiers (   $identifier)

Definition at line 79 of file EntityTest.php.

References getEntityFactory().

79  : void
80  {
81  $entity = $this->getEntityFactory()->standard($identifier, $identifier);
82  $this->assertEquals($identifier, $entity->getPrimaryIdentifier());
83  $this->assertEquals($identifier, $entity->getSecondaryIdentifier());
84  }
getEntityFactory()
Definition: EntityTest.php:34
+ Here is the call graph for this function:

◆ testEntityRendering()

EntityTest::testEntityRendering ( )

Definition at line 126 of file EntityTest.php.

References $r, getEntityFactory(), and legacy().

126  : void
127  {
128  $glyph = new Symbol\Glyph\Glyph('laugh', 'some glyph');
129  $tag = new Button\Tag('tag', '#');
130  $shy = new Button\Shy('shy', '#');
131  $entity = $this->getEntityFactory()->standard('primary', 'secondary')
132  ->withPrioritizedReactions($glyph, $tag)
133  ->withReactions($glyph, $glyph)
134  ->withActions($shy, $shy)
135  ->withBlockingAvailabilityConditions($this->legacy('bc'))
136  ->withFeaturedProperties($this->legacy('fp'))
137  ->withMainDetails($this->legacy('md'))
138  ->withPersonalStatus($this->legacy('ps'))
139  ->withAvailability($this->legacy('a'))
140  ->withDetails($this->legacy('d'));
141 
142  $r = $this->getDefaultRenderer();
143  $html = $this->brutallyTrimHTML($r->render($entity));
144  $expected = $this->brutallyTrimHTML('
145 <div class="c-entity __container">
146  <div class="c-entity __blocking-conditions">bc</div>
147  <div class="c-entity __actions">
148  <div class="dropdown" id="id_9">
149  <button class="btn btn-default dropdown-toggle" type="button" aria-label="actions" aria-haspopup="true" aria-expanded="false" aria-controls="id_9_menu"><span class="caret"></span></button>
150  <ul id="id_9_menu" class="dropdown-menu">
151  <li><button class="btn btn-link" data-action="#" id="id_7">shy</button></li>
152  <li><button class="btn btn-link" data-action="#" id="id_8">shy</button></li>
153  </ul>
154  </div>
155  </div>
156  <div class="c-entity __secondary-identifier --string ">secondary</div>
157  <div class="c-entity __primary-identifier">primary</div>
158  <div class="c-entity __featured">fp</div>
159  <div class="c-entity __personal-status">ps</div>
160  <div class="c-entity __main-details">md</div>
161  <div class="c-entity __availability">a</div>
162  <div class="c-entity __details">d</div>
163  <div class="c-entity __reactions">
164  <a class="glyph" aria-label="some glyph"><span class="glyphicon il-glyphicon-laugh" aria-hidden="true"></span></a>
165  <a class="glyph" aria-label="some glyph"><span class="glyphicon il-glyphicon-laugh" aria-hidden="true"></span></a>
166  </div>
167  <div class="c-entity __featured-reactions">
168  <a class="glyph" aria-label="some glyph"><span class="glyphicon il-glyphicon-laugh" aria-hidden="true"></span></a>
169  <button class="btn btn-tag btn-tag-relevance-veryhigh" data-action="#" id="id_10">tag</button>
170  </div>
171 </div>
172  ');
173  $this->assertEquals($expected, $html);
174  }
getEntityFactory()
Definition: EntityTest.php:34
legacy(string $string)
Definition: EntityTest.php:39
$r
+ Here is the call graph for this function:

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