ILIAS  trunk Revision v11.0_alpha-1843-g9e1fad99175
All Data Structures Namespaces Files Functions Variables Enumerations Enumerator Modules Pages
EntityTest Class Reference
+ Inheritance diagram for EntityTest:
+ Collaboration diagram for EntityTest:

Public Member Functions

 testEntityFactory ()
 
 testEntityBasicProperties ()
 
 testEntityIdentifiers ($identifier)
 getEntityAllowedIdentiferTypes More...
 
 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 119 of file EntityTest.php.

119  : NoUIFactory
120  {
121  return new class () extends NoUIFactory {
122  public function dropdown(): Dropdown\Factory
123  {
124  return new Dropdown\Factory();
125  }
126  };
127  }
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 88 of file EntityTest.php.

References getEntityFactory().

88  : void
89  {
90  $glyph = new Symbol\Glyph\Glyph('laugh', 'some glyph');
91  $tag = new Button\Tag('tag', '#');
92  $shy = new Button\Shy('shy', '#');
93  $entity = $this->getEntityFactory()->standard('primary', 'secondary')
94  ->withPrioritizedReactions($glyph, $tag)
95  ->withReactions($glyph, $glyph, $glyph)
96  ->withActions($shy);
97 
98  $this->assertEquals([$glyph, $tag], $entity->getPrioritizedReactions());
99  $this->assertEquals([$glyph,$glyph,$glyph], $entity->getReactions());
100  $this->assertEquals([$shy], $entity->getActions());
101  }
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 103 of file EntityTest.php.

References getEntityFactory().

103  : void
104  {
105  $glyph = new Symbol\Glyph\Glyph('laugh', 'some glyph');
106  $tag = new Button\Tag('tag', '#');
107  $shy = new Button\Shy('shy', '#');
108  $entity = $this->getEntityFactory()->standard('primary', 'secondary')
109  ->withPrioritizedReactions($glyph, $tag)
110  ->withReactions($glyph)
111  ->withActions($shy);
112 
113  $this->assertEquals([$glyph, $tag], $entity->getPrioritizedReactions());
114  $this->assertEquals([$glyph], $entity->getReactions());
115  $this->assertEquals([$shy], $entity->getActions());
116  }
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)

getEntityAllowedIdentiferTypes

Definition at line 81 of file EntityTest.php.

References getEntityFactory().

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

◆ testEntityRendering()

EntityTest::testEntityRendering ( )

Definition at line 128 of file EntityTest.php.

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

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