ILIAS
trunk Revision v11.0_alpha-1723-g8e69f309bab
◀ ilDoc Overview
Main Page
Related Pages
Modules
+
Namespaces
Namespace List
+
Namespace Members
+
All
$
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
+
Functions
_
a
b
c
d
e
f
g
h
i
k
l
m
n
o
p
r
s
t
u
v
w
x
+
Variables
$
c
e
g
h
j
l
m
p
s
t
u
v
+
Enumerations
a
c
e
f
i
j
l
m
n
o
p
r
s
t
u
v
z
+
Enumerator
a
c
d
e
f
g
i
l
m
n
o
p
q
s
t
u
v
y
+
Data Structures
Data Structures
Data Structure Index
Class Hierarchy
+
Data Fields
+
All
$
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
Ö
+
Functions
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
+
Variables
$
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
Ö
Enumerations
Enumerator
+
Files
File List
+
Globals
+
All
$
a
b
c
d
e
f
g
h
i
l
m
n
o
p
r
s
t
u
v
z
+
Functions
a
b
c
d
e
f
g
h
i
m
n
p
r
s
t
u
v
+
Variables
$
a
c
e
g
h
i
m
n
o
p
r
s
t
u
v
z
Enumerations
Enumerator
Examples
•
All
Data Structures
Namespaces
Files
Functions
Variables
Enumerations
Enumerator
Modules
Pages
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
(): 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
}
57
58
public
function
testEntityListingFactory
(): void
59
{
60
$this->assertInstanceOf(
61
I
\
Listing
\
Entity
\EntityListing::class,
62
$this->
getUIFactory
()->
listing
()->entity()->
standard
($this->
getEntityMapping
())
63
);
64
}
65
66
public
function
testEntityListingYieldingEntities
(): 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
}
92
}
NoUIFactory
Definition:
Base.php:57
$data
$data
Definition:
ltiregistration.php:29
ILIAS\UI\Component\Entity\Entity
This describes an Entity.
Definition:
Entity.php:36
ILIAS\UI\Implementation\Component\Entity\Factory
Definition:
Factory.php:29
ILIAS\UI\Implementation
ILIAS\UI\examples\MainControls\Slate\Notification\standard
standard()
description: > This is an example, of how the Notification Slate is generated by assigning Notificat...
Definition:
standard.php:38
Factory
ILIAS\Repository\listing
listing()
Definition:
trait.GlobalDICGUIServices.php:215
ILIAS\UI\Component
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:58
ILIAS\UI\Implementation\Component\Entity
Definition:
Entity.php:21
EntityListingTest
Definition:
EntityListingTest.php:27
EntityListingTest\getEntityMapping
getEntityMapping()
Definition:
EntityListingTest.php:29
EntityListingTest\testEntityListingYieldingEntities
testEntityListingYieldingEntities()
Definition:
EntityListingTest.php:66
ILIAS_UI_TestBase
EntityListingTest\getUIFactory
getUIFactory()
Definition:
EntityListingTest.php:40
ILIAS\UI\Implementation\Component\Table\$range
Range $range
Definition:
TableViewControlPagination.php:30
ILIAS\UI\Implementation\Component\Listing
DataRetrieval
ILIAS\UI\Implementation\Component\Entity\Entity
Definition:
Entity.php:34
ILIAS\Data\Range
A simple class to express a naive range of whole positive numbers.
Definition:
Range.php:28
components
ILIAS
UI
tests
Component
Listing
Entity
EntityListingTest.php
Generated on Sun Apr 6 2025 23:04:38 for ILIAS by
1.8.13 (using
Doxyfile
)