ILIAS
release_9 Revision v9.13-25-g2c18ec4c24f
◀ ilDoc Overview
EntityListingTest.php
Go to the documentation of this file.
1
<?php
2
19
declare(strict_types=1);
20
21
use
ILIAS\UI\Implementation\Component\Listing
;
22
use
ILIAS\UI\Implementation\Component\Entity
;
23
use
ILIAS\UI\Component
as
I
;
24
use
ILIAS\UI\Factory
as
UIFactory
;
25
use
ILIAS\Data\Range
;
26
27
class
EntityListingTest
extends
ILIAS_UI_TestBase
28
{
29
public
function
getEntityMapping
():
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
}
40
public
function
getUIFactory
():
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
}
53
54
public
function
testEntityListingFactory
(): void
55
{
56
$this->assertInstanceOf(
57
I
\
Listing
\
Entity
\EntityListing::class,
58
$this->
getUIFactory
()->
listing
()->entity()->
standard
($this->
getEntityMapping
())
59
);
60
}
61
62
public
function
testEntityListingYieldingEntities
(): 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
}
88
}
NoUIFactory
Definition:
Base.php:56
$data
$data
Definition:
ltiregistration.php:31
ILIAS\UI\Component\Entity\Entity
This describes an Entity.
Definition:
Entity.php:36
ILIAS\UI\Implementation
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
ILIAS\UI\examples\MainControls\Slate\Notification\standard
standard()
This is an example, of how the Notification Slate is generated by assigning Notification Items to it...
Definition:
standard.php:16
Factory
ILIAS\Repository\listing
listing()
Definition:
trait.GlobalDICGUIServices.php:209
ILIAS\UI\Component
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
ILIAS\UI\Implementation\Component\Listing\Listing
Definition:
Listing.php:30
ILIAS\UI\Component\Entity\Factory
This is the factory for Entities.
Definition:
Factory.php:31
Range
EntityListingTest\testEntityListingFactory
testEntityListingFactory()
Definition:
EntityListingTest.php:54
ILIAS\UI\Implementation\Component\Entity
Definition:
Entity.php:21
ILIAS_UI_TestBase
Provides common functionality for UI tests.
Definition:
Base.php:310
EntityListingTest
Definition:
EntityListingTest.php:27
EntityListingTest\getEntityMapping
getEntityMapping()
Definition:
EntityListingTest.php:29
EntityListingTest\testEntityListingYieldingEntities
testEntityListingYieldingEntities()
Definition:
EntityListingTest.php:62
EntityListingTest\getUIFactory
getUIFactory()
Definition:
EntityListingTest.php:40
ILIAS\UI\Implementation\Component\Table\$range
Range $range
Definition:
TableViewControlPagination.php:30
ILIAS\UI\Implementation\Component\Listing
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
DataRetrieval
ILIAS\UI\Implementation\Component\Entity\Entity
Definition:
Entity.php:36
ILIAS\Data\Range
A simple class to express a range of whole positive numbers.
Definition:
Range.php:30
tests
UI
Component
Listing
Entity
EntityListingTest.php
Generated on Wed Sep 10 2025 14:12:17 for ILIAS by
1.8.13 (using
Doxyfile
)