ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
ILIAS\MetaData\Services\ServicesTest Class Reference
+ Inheritance diagram for ILIAS\MetaData\Services\ServicesTest:
+ Collaboration diagram for ILIAS\MetaData\Services\ServicesTest:

Public Member Functions

 testRead ()
 
 testReadWithPath ()
 
 testReadWithSubIDZero ()
 
 testManipulate ()
 
 testManipulateWithSubIDZero ()
 
 testDeleteAll ()
 
 testDeleteAllWithSubIDZero ()
 

Protected Member Functions

 getServices ()
 

Detailed Description

Definition at line 39 of file ServicesTest.php.

Member Function Documentation

◆ getServices()

ILIAS\MetaData\Services\ServicesTest::getServices ( )
protected

Definition at line 41 of file ServicesTest.php.

41 : Services
42 {
43 return new class () extends Services {
44 public array $repositories = [];
45
46 public function __construct()
47 {
48 }
49
50 protected function repository(): RepositoryInterface
51 {
52 return $this->repositories[] = new class () extends NullRepository {
53 public array $deleted_md = [];
54
55 public function getMD(int $obj_id, int $sub_id, string $type): SetInterface
56 {
57 return new class ($obj_id, $sub_id, $type) extends NullSet {
58 public array $data;
59
60 public function __construct(int $obj_id, int $sub_id, string $type)
61 {
62 $this->data = [
63 'obj_id' => $obj_id,
64 'sub_id' => $sub_id,
65 'type' => $type,
66 ];
67 }
68 };
69 }
70
71 public function getMDOnPath(
72 PathInterface $path,
73 int $obj_id,
74 int $sub_id,
75 string $type
76 ): SetInterface {
77 return new class ($path, $obj_id, $sub_id, $type) extends NullSet {
78 public array $data;
79
80 public function __construct(PathInterface $path, int $obj_id, int $sub_id, string $type)
81 {
82 $this->data = [
83 'path' => $path,
84 'obj_id' => $obj_id,
85 'sub_id' => $sub_id,
86 'type' => $type,
87 ];
88 }
89 };
90 }
91
92 public function deleteAllMD(int $obj_id, int $sub_id, string $type): void
93 {
94 $this->deleted_md[] = [
95 'obj_id' => $obj_id,
96 'sub_id' => $sub_id,
97 'type' => $type
98 ];
99 }
100 };
101 }
102
103 protected function readerFactory(): ReaderFactoryInterface
104 {
105 return new class () extends NullReaderFactory {
106 public function get(SetInterface $set): ReaderInterface
107 {
108 return new class ($set) extends NullReader {
109 public function __construct(public SetInterface $set)
110 {
111 }
112 };
113 }
114 };
115 }
116
117 protected function manipulatorFactory(): ManipulatorFactoryInterface
118 {
119 return new class () extends NullManipulatorFactory {
120 public function get(SetInterface $set): ManipulatorInterface
121 {
122 return new class ($set) extends NullManipulator {
123 public function __construct(public SetInterface $set)
124 {
125 }
126 };
127 }
128 };
129 }
130 };
131 }
__construct()
Constructor setup ILIAS global object @access public.
Definition: class.ilias.php:76
return['delivery_method'=> 'php',]
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
$path
Definition: ltiservices.php:30

References $data, $path, ILIAS\__construct(), and ILIAS\UI\examples\Deck\repository().

Referenced by ILIAS\MetaData\Services\ServicesTest\testDeleteAll(), ILIAS\MetaData\Services\ServicesTest\testDeleteAllWithSubIDZero(), ILIAS\MetaData\Services\ServicesTest\testManipulate(), ILIAS\MetaData\Services\ServicesTest\testManipulateWithSubIDZero(), ILIAS\MetaData\Services\ServicesTest\testRead(), ILIAS\MetaData\Services\ServicesTest\testReadWithPath(), and ILIAS\MetaData\Services\ServicesTest\testReadWithSubIDZero().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ testDeleteAll()

ILIAS\MetaData\Services\ServicesTest::testDeleteAll ( )

Definition at line 189 of file ServicesTest.php.

189 : void
190 {
191 $services = $this->getServices();
192 $services->deleteAll(34, 90, 'type');
193
194 $this->assertCount(1, $services->repositories);
195 $this->assertCount(1, $services->repositories[0]->deleted_md);
196 $this->assertSame(
197 ['obj_id' => 34, 'sub_id' => 90, 'type' => 'type'],
198 $services->repositories[0]->deleted_md[0]
199 );
200 }

References ILIAS\MetaData\Services\ServicesTest\getServices().

+ Here is the call graph for this function:

◆ testDeleteAllWithSubIDZero()

ILIAS\MetaData\Services\ServicesTest::testDeleteAllWithSubIDZero ( )

Definition at line 202 of file ServicesTest.php.

202 : void
203 {
204 $services = $this->getServices();
205 $services->deleteAll(789, 0, 'type');
206
207 $this->assertCount(1, $services->repositories);
208 $this->assertCount(1, $services->repositories[0]->deleted_md);
209 $this->assertSame(
210 ['obj_id' => 789, 'sub_id' => 789, 'type' => 'type'],
211 $services->repositories[0]->deleted_md[0]
212 );
213 }

References ILIAS\MetaData\Services\ServicesTest\getServices().

+ Here is the call graph for this function:

◆ testManipulate()

ILIAS\MetaData\Services\ServicesTest::testManipulate ( )

Definition at line 167 of file ServicesTest.php.

167 : void
168 {
169 $services = $this->getServices();
170 $manipulator = $services->manipulate(5, 17, 'type');
171
172 $this->assertSame(
173 ['obj_id' => 5, 'sub_id' => 17, 'type' => 'type'],
174 $manipulator->set->data
175 );
176 }

References ILIAS\MetaData\Services\ServicesTest\getServices().

+ Here is the call graph for this function:

◆ testManipulateWithSubIDZero()

ILIAS\MetaData\Services\ServicesTest::testManipulateWithSubIDZero ( )

Definition at line 178 of file ServicesTest.php.

178 : void
179 {
180 $services = $this->getServices();
181 $manipulator = $services->manipulate(35, 0, 'type');
182
183 $this->assertSame(
184 ['obj_id' => 35, 'sub_id' => 35, 'type' => 'type'],
185 $manipulator->set->data
186 );
187 }

References ILIAS\MetaData\Services\ServicesTest\getServices().

+ Here is the call graph for this function:

◆ testRead()

ILIAS\MetaData\Services\ServicesTest::testRead ( )

Definition at line 133 of file ServicesTest.php.

133 : void
134 {
135 $services = $this->getServices();
136 $reader = $services->read(5, 17, 'type');
137
138 $this->assertSame(
139 ['obj_id' => 5, 'sub_id' => 17, 'type' => 'type'],
140 $reader->set->data
141 );
142 }

References ILIAS\MetaData\Services\ServicesTest\getServices().

+ Here is the call graph for this function:

◆ testReadWithPath()

ILIAS\MetaData\Services\ServicesTest::testReadWithPath ( )

Definition at line 144 of file ServicesTest.php.

144 : void
145 {
146 $services = $this->getServices();
147 $path = new NullPath();
148 $reader = $services->read(5, 17, 'type', $path);
149
150 $this->assertSame(
151 ['path' => $path, 'obj_id' => 5, 'sub_id' => 17, 'type' => 'type'],
152 $reader->set->data
153 );
154 }

References $path, and ILIAS\MetaData\Services\ServicesTest\getServices().

+ Here is the call graph for this function:

◆ testReadWithSubIDZero()

ILIAS\MetaData\Services\ServicesTest::testReadWithSubIDZero ( )

Definition at line 156 of file ServicesTest.php.

156 : void
157 {
158 $services = $this->getServices();
159 $reader = $services->read(23, 0, 'type');
160
161 $this->assertSame(
162 ['obj_id' => 23, 'sub_id' => 23, 'type' => 'type'],
163 $reader->set->data
164 );
165 }

References ILIAS\MetaData\Services\ServicesTest\getServices().

+ Here is the call graph for this function:

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