ILIAS  release_10 Revision v10.1-43-ga1241a92c2f
EntityListingTest Class Reference
+ Inheritance diagram for EntityListingTest:
+ Collaboration diagram for EntityListingTest:

Public Member Functions

 getEntityMapping ()
 
 getUIFactory ()
 
 testEntityListingFactory ()
 
 testEntityListingYieldingEntities ()
 

Detailed Description

Definition at line 27 of file EntityListingTest.php.

Member Function Documentation

◆ getEntityMapping()

EntityListingTest::getEntityMapping ( )

Definition at line 29 of file EntityListingTest.php.

Referenced by testEntityListingFactory(), and testEntityListingYieldingEntities().

29  : I\Listing\Entity\RecordToEntity
30  {
31  return new class () implements I\Listing\Entity\RecordToEntity {
32  public function map(
33  UIFactory $ui_factory,
34  mixed $record
35  ): Entity\Entity {
36  return $ui_factory->entity()->standard('primary', 'secondary');
37  }
38  };
39  }
+ Here is the caller graph for this function:

◆ getUIFactory()

EntityListingTest::getUIFactory ( )

Definition at line 40 of file EntityListingTest.php.

References ILIAS\Repository\listing().

Referenced by testEntityListingFactory(), and testEntityListingYieldingEntities().

40  : NoUIFactory
41  {
42  return new class () extends NoUIFactory {
43  public function listing(): I\Listing\Factory
44  {
45  return new Listing\Factory();
46  }
47  public function entity(): I\Entity\Factory
48  {
49  return new Entity\Factory();
50  }
51  };
52  }
This is the factory for Entities.
Definition: Factory.php:31
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ testEntityListingFactory()

EntityListingTest::testEntityListingFactory ( )

Definition at line 54 of file EntityListingTest.php.

References getEntityMapping(), getUIFactory(), ILIAS\Repository\listing(), and ILIAS\UI\examples\MainControls\Slate\Notification\standard().

54  : void
55  {
56  $this->assertInstanceOf(
57  I\Listing\Entity\EntityListing::class,
58  $this->getUIFactory()->listing()->entity()->standard($this->getEntityMapping())
59  );
60  }
standard()
description: > This is an example, of how the Notification Slate is generated by assigning Notificat...
Definition: standard.php:22
+ Here is the call graph for this function:

◆ testEntityListingYieldingEntities()

EntityListingTest::testEntityListingYieldingEntities ( )

Definition at line 62 of file EntityListingTest.php.

References $data, ILIAS\UI\Implementation\Component\Table\$range, getEntityMapping(), and getUIFactory().

62  : void
63  {
64  $data = new class () implements I\Listing\Entity\DataRetrieval {
65  protected $data = [1,2,3];
66 
67  public function getEntities(
68  I\Listing\Entity\Mapping $mapping,
69  ?Range $range,
70  ?array $additional_parameters
71  ): \Generator {
72  foreach ($this->data as $entry) {
73  yield $mapping->map($entry);
74  }
75  }
76  };
77 
78  $listing = $this->getUIFactory()->listing()->entity()
79  ->standard($this->getEntityMapping())
80  ->withData($data);
81 
82  $entities = iterator_to_array($listing->getEntities($this->getUIFactory()));
83 
84  $this->assertCount(3, $entities);
85 
86  $this->assertInstanceOf(I\Entity\Entity::class, array_pop($entities));
87  }
A simple class to express a naive range of whole positive numbers.
Definition: Range.php:28
+ Here is the call graph for this function:

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