ILIAS  trunk Revision v11.0_alpha-1749-g1a06bdef097
All Data Structures Namespaces Files Functions Variables Enumerations Enumerator Modules Pages
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(): Listing\Factory
44  {
45  return new Listing\Factory(
46  new Listing\Workflow\Factory(),
47  new Listing\CharacteristicValue\Factory(),
48  new Listing\Entity\Factory(),
49  );
50  }
51  public function entity(): Entity\Factory
52  {
53  return new Entity\Factory();
54  }
55  };
56  }
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 58 of file EntityListingTest.php.

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

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

◆ testEntityListingYieldingEntities()

EntityListingTest::testEntityListingYieldingEntities ( )

Definition at line 66 of file EntityListingTest.php.

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

66  : void
67  {
68  $data = new class () implements I\Listing\Entity\DataRetrieval {
69  protected $data = [1,2,3];
70 
71  public function getEntities(
72  I\Listing\Entity\Mapping $mapping,
73  ?Range $range,
74  ?array $additional_parameters
75  ): \Generator {
76  foreach ($this->data as $entry) {
77  yield $mapping->map($entry);
78  }
79  }
80  };
81 
82  $listing = $this->getUIFactory()->listing()->entity()
83  ->standard($this->getEntityMapping())
84  ->withData($data);
85 
86  $entities = iterator_to_array($listing->getEntities($this->getUIFactory()));
87 
88  $this->assertCount(3, $entities);
89 
90  $this->assertInstanceOf(I\Entity\Entity::class, array_pop($entities));
91  }
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: