Completed
Push — 3.x ( 91f8ca...b0e4d8 )
by Grégoire
02:58
created

PoolTest::getContainer()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 11

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 11
rs 9.9
c 0
b 0
f 0
cc 1
nc 1
nop 0
1
<?php
2
3
declare(strict_types=1);
4
5
/*
6
 * This file is part of the Sonata Project package.
7
 *
8
 * (c) Thomas Rabaix <[email protected]>
9
 *
10
 * For the full copyright and license information, please view the LICENSE
11
 * file that was distributed with this source code.
12
 */
13
14
namespace Sonata\AdminBundle\Tests\Admin;
15
16
use PHPUnit\Framework\MockObject\MockObject;
17
use PHPUnit\Framework\TestCase;
18
use Sonata\AdminBundle\Admin\AdminInterface;
19
use Sonata\AdminBundle\Admin\Pool;
20
use Sonata\AdminBundle\Templating\MutableTemplateRegistryInterface;
21
use Symfony\Component\DependencyInjection\Container;
22
use Symfony\Component\DependencyInjection\ContainerInterface;
23
24
class PoolTest extends TestCase
25
{
26
    /**
27
     * @var Container
28
     */
29
    private $container;
30
31
    /**
32
     * @var Pool
33
     */
34
    private $pool;
35
36
    public function setUp(): void
37
    {
38
        $this->container = new Container();
39
        $this->pool = new Pool($this->container, 'Sonata Admin', '/path/to/pic.png', ['foo' => 'bar']);
40
    }
41
42
    public function testGetGroups(): void
43
    {
44
        $this->container->set('sonata.user.admin.group1', $this->createMock(AdminInterface::class));
45
46
        $this->pool->setAdminServiceIds(['sonata.user.admin.group1']);
47
48
        $this->pool->setAdminGroups([
49
            'adminGroup1' => ['sonata.user.admin.group1' => []],
50
        ]);
51
52
        $result = $this->pool->getGroups();
53
        $this->assertArrayHasKey('adminGroup1', $result);
54
        $this->assertArrayHasKey('sonata.user.admin.group1', $result['adminGroup1']);
55
    }
56
57
    public function testHasGroup(): void
58
    {
59
        $this->pool->setAdminGroups([
60
            'adminGroup1' => [],
61
        ]);
62
63
        $this->assertTrue($this->pool->hasGroup('adminGroup1'));
64
        $this->assertFalse($this->pool->hasGroup('adminGroup2'));
65
    }
66
67
    public function testGetDashboardGroups(): void
68
    {
69
        $adminGroup1 = $this->createMock(AdminInterface::class);
70
        $adminGroup1->expects($this->once())->method('showIn')->willReturn(true);
71
72
        $adminGroup2 = $this->createMock(AdminInterface::class);
73
        $adminGroup2->expects($this->once())->method('showIn')->willReturn(false);
74
75
        $adminGroup3 = $this->createMock(AdminInterface::class);
76
        $adminGroup3->expects($this->once())->method('showIn')->willReturn(false);
77
78
        $this->container->set('sonata.user.admin.group1', $adminGroup1);
79
        $this->container->set('sonata.user.admin.group2', $adminGroup2);
80
        $this->container->set('sonata.user.admin.group3', $adminGroup3);
81
82
        $this->pool->setAdminServiceIds(['sonata.user.admin.group1', 'sonata.user.admin.group2', 'sonata.user.admin.group3']);
83
84
        $this->pool->setAdminGroups([
85
            'adminGroup1' => [
86
                'items' => ['itemKey' => $this->getItemArray('sonata.user.admin.group1')],
87
            ],
88
            'adminGroup2' => [
89
                'items' => ['itemKey' => $this->getItemArray('sonata.user.admin.group2')],
90
            ],
91
            'adminGroup3' => [
92
                'items' => ['itemKey' => $this->getItemArray('sonata.user.admin.group3')],
93
            ],
94
        ]);
95
96
        $groups = $this->pool->getDashboardGroups();
97
98
        $this->assertCount(1, $groups);
99
        $this->assertSame($adminGroup1, $groups['adminGroup1']['items']['itemKey']);
100
    }
101
102
    public function testGetAdminsByGroupWhenGroupNotSet(): void
103
    {
104
        $this->expectException(\InvalidArgumentException::class);
105
106
        $this->pool->setAdminGroups([
107
                'adminGroup1' => [],
108
            ]);
109
110
        $this->pool->getAdminsByGroup('adminGroup2');
111
    }
112
113
    public function testGetAdminsByGroupWhenGroupIsEmpty(): void
114
    {
115
        $this->pool->setAdminGroups([
116
                'adminGroup1' => [],
117
            ]);
118
119
        $this->assertSame([], $this->pool->getAdminsByGroup('adminGroup1'));
120
    }
121
122
    public function testGetAdminsByGroup(): void
123
    {
124
        $this->container->set('sonata.admin1', $this->createMock(AdminInterface::class));
125
        $this->container->set('sonata.admin2', $this->createMock(AdminInterface::class));
126
        $this->container->set('sonata.admin3', $this->createMock(AdminInterface::class));
127
128
        $this->pool->setAdminServiceIds(['sonata.admin1', 'sonata.admin2', 'sonata.admin3']);
129
        $this->pool->setAdminGroups([
130
            'adminGroup1' => [
131
                'items' => [
132
                    $this->getItemArray('sonata.admin1'),
133
                    $this->getItemArray('sonata.admin2'),
134
                ],
135
            ],
136
            'adminGroup2' => [
137
                'items' => [$this->getItemArray('sonata.admin3')],
138
            ],
139
        ]);
140
141
        $this->assertCount(2, $this->pool->getAdminsByGroup('adminGroup1'));
142
        $this->assertCount(1, $this->pool->getAdminsByGroup('adminGroup2'));
143
    }
144
145
    public function testGetAdminForClassWhenAdminClassIsNotSet(): void
146
    {
147
        $this->pool->setAdminClasses(['someclass' => 'sonata.user.admin.group1']);
148
        $this->assertFalse($this->pool->hasAdminByClass('notexists'));
149
        $this->assertNull($this->pool->getAdminByClass('notexists'));
150
    }
151
152
    public function testGetAdminForClassWithInvalidFormat(): void
153
    {
154
        $this->expectException(\RuntimeException::class);
155
156
        $this->pool->setAdminClasses(['someclass' => 'sonata.user.admin.group1']);
157
        $this->assertTrue($this->pool->hasAdminByClass('someclass'));
158
159
        $this->pool->getAdminByClass('someclass');
160
    }
161
162
    public function testGetAdminForClassWithTooManyRegisteredAdmin(): void
163
    {
164
        $this->expectException(\RuntimeException::class);
165
166
        $this->pool->setAdminClasses([
167
            'someclass' => ['sonata.user.admin.group1', 'sonata.user.admin.group2'],
168
        ]);
169
170
        $this->assertTrue($this->pool->hasAdminByClass('someclass'));
171
        $this->pool->getAdminByClass('someclass');
172
    }
173
174
    public function testGetAdminForClassWhenAdminClassIsSet(): void
175
    {
176
        $this->container->set('sonata.user.admin.group1', $this->createMock(AdminInterface::class));
177
178
        $this->pool->setAdminServiceIds(['sonata.user.admin.group1']);
179
        $this->pool->setAdminClasses([
180
            'someclass' => ['sonata.user.admin.group1'],
181
        ]);
182
183
        $this->assertTrue($this->pool->hasAdminByClass('someclass'));
184
        $this->assertInstanceOf(AdminInterface::class, $this->pool->getAdminByClass('someclass'));
185
    }
186
187
    public function testGetInstanceWithUndefinedServiceId(): void
188
    {
189
        $this->expectException(\InvalidArgumentException::class);
190
        $this->expectExceptionMessage('Admin service "sonata.news.admin.post" not found in admin pool.');
191
192
        $this->pool->getInstance('sonata.news.admin.post');
193
    }
194
195
    public function testGetInstanceWithUndefinedServiceIdAndExistsOther(): void
196
    {
197
        $this->pool->setAdminServiceIds([
198
            'sonata.news.admin.post',
199
            'sonata.news.admin.category',
200
        ]);
201
202
        $this->expectException(\InvalidArgumentException::class);
203
        $this->expectExceptionMessage('Admin service "sonata.news.admin.pos" not found in admin pool. '
204
            .'Did you mean "sonata.news.admin.post" '
205
            .'or one of those: [sonata.news.admin.category]?');
206
207
        $this->pool->getInstance('sonata.news.admin.pos');
208
    }
209
210
    public function testGetAdminByAdminCode(): void
211
    {
212
        $this->container->set('sonata.news.admin.post', $this->createMock(AdminInterface::class));
213
214
        $this->pool->setAdminServiceIds(['sonata.news.admin.post']);
215
216
        $this->assertInstanceOf(AdminInterface::class, $this->pool->getAdminByAdminCode('sonata.news.admin.post'));
217
    }
218
219
    public function testGetAdminByAdminCodeForChildClass(): void
220
    {
221
        $adminMock = $this->createMock(AdminInterface::class);
222
        $adminMock
223
            ->method('hasChild')
224
            ->willReturn(true);
225
226
        $childAdmin = $this->createMock(AdminInterface::class);
227
228
        $adminMock->expects($this->once())
229
            ->method('getChild')
230
            ->with($this->equalTo('sonata.news.admin.comment'))
231
            ->willReturn($childAdmin);
232
233
        $this->container->set('sonata.news.admin.post', $adminMock);
234
235
        $this->pool->setAdminServiceIds(['sonata.news.admin.post', 'sonata.news.admin.comment']);
236
237
        $this->assertSame($childAdmin, $this->pool->getAdminByAdminCode('sonata.news.admin.post|sonata.news.admin.comment'));
238
    }
239
240
    /**
241
     * @group legacy
242
     *
243
     * @expectedDeprecation Passing an invalid admin code as argument 1 for Sonata\AdminBundle\Admin\Pool::getAdminByAdminCode() is deprecated since sonata-project/admin-bundle 3.50 and will throw an exception in 4.0.
244
     */
245
    public function testGetAdminByAdminCodeWithInvalidCode(): void
246
    {
247
        $adminMock = $this->createMock(AdminInterface::class);
248
        $adminMock
249
            ->method('hasChild')
250
            ->willReturn(false);
251
252
        $this->container->set('sonata.news.admin.post', $adminMock);
253
        $this->pool->setAdminServiceIds(['sonata.news.admin.post']);
254
255
        // NEXT_MAJOR: remove the assertion around getAdminByAdminCode(), remove the "@group" and "@expectedDeprecation" annotations, and uncomment the following line
256
        // $this->expectException(\InvalidArgumentException::class);
257
        $this->assertFalse($this->pool->getAdminByAdminCode('sonata.news.admin.post|sonata.news.admin.invalid'));
258
    }
259
260
    /**
261
     * @dataProvider getNonStringAdminServiceNames
262
     *
263
     * @group legacy
264
     *
265
     * @expectedDeprecation Passing a non string value as argument 1 for Sonata\AdminBundle\Admin\Pool::getAdminByAdminCode() is deprecated since sonata-project/admin-bundle 3.51 and will cause a \TypeError in 4.0.
266
     */
267
    public function testGetAdminByAdminCodeWithNonStringCode($adminId): void
268
    {
269
        // NEXT_MAJOR: remove the assertion around getAdminByAdminCode(), remove the "@group" and "@expectedDeprecation" annotations, and uncomment the following line
270
        // $this->expectException(\TypeError::class);
271
        $this->assertFalse($this->pool->getAdminByAdminCode($adminId));
272
    }
273
274
    public function getNonStringAdminServiceNames(): array
275
    {
276
        return [
277
            [null],
278
            [false],
279
            [1],
280
            [['some_value']],
281
            [new \stdClass()],
282
        ];
283
    }
284
285
    /**
286
     * @group legacy
287
     *
288
     * @expectedDeprecation Passing an invalid admin hierarchy inside argument 1 for %s() is deprecated since sonata-project/admin-bundle 3.51 and will throw an exception in 4.0.
289
     */
290
    public function testGetAdminByAdminCodeWithCodeNotChild(): void
291
    {
292
        $adminMock = $this->createMock(AdminInterface::class);
293
        $adminMock
294
            ->method('hasChild')
295
            ->willReturn(false);
296
297
        $this->container->set('sonata.news.admin.post', $adminMock);
298
        $this->pool->setAdminServiceIds(['sonata.news.admin.post', 'sonata.news.admin.valid']);
299
        $this->assertFalse($this->pool->getAdminByAdminCode('sonata.news.admin.post|sonata.news.admin.invalid'));
300
301
        // NEXT_MAJOR: remove the "@group" and "@expectedDeprecation" annotations, the previous assertion and uncomment the following lines
302
        // $this->expectException(\InvalidArgumentException::class);
303
        // $this->expectExceptionMessage('Argument 1 passed to Sonata\AdminBundle\Admin\Pool::getAdminByAdminCode() must contain a valid admin hierarchy, "sonata.news.admin.valid" is not a valid child for "sonata.news.admin.post"');
304
        //
305
        // $this->pool->getAdminByAdminCode('sonata.news.admin.post|sonata.news.admin.valid');
306
    }
307
308
    /**
309
     * @dataProvider getEmptyRootAdminServiceNames
310
     */
311
    public function testGetAdminByAdminCodeWithInvalidRootCode(string $adminId): void
312
    {
313
        $adminMock = $this->createMock(AdminInterface::class);
314
        $adminMock->expects($this->never())
315
            ->method('hasChild');
316
317
        /** @var MockObject|Pool $poolMock */
318
        $poolMock = $this->getMockBuilder(Pool::class)
319
            ->setConstructorArgs([$this->container, 'Sonata', '/path/to/logo.png'])
320
            ->disableOriginalClone()
321
            ->setMethodsExcept(['getAdminByAdminCode'])
322
            ->getMock();
323
        $poolMock->expects($this->never())
0 ignored issues
show
Bug introduced by
The method expects() does not seem to exist on object<Sonata\AdminBundle\Admin\Pool>.

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
324
            ->method('getInstance');
325
326
        $this->expectException(\InvalidArgumentException::class);
327
        $this->expectExceptionMessage('Root admin code must contain a valid admin reference, empty string given.');
328
        $poolMock->getAdminByAdminCode($adminId);
329
    }
330
331
    public function getEmptyRootAdminServiceNames()
332
    {
333
        return [
334
            [''],
335
            ['   '],
336
            ['|sonata.news.admin.child_of_empty_code'],
337
        ];
338
    }
339
340
    /**
341
     * @dataProvider getInvalidChildAdminServiceNames
342
     *
343
     * @group legacy
344
     *
345
     * @expectedDeprecation Passing an invalid admin code as argument 1 for Sonata\AdminBundle\Admin\Pool::getAdminByAdminCode() is deprecated since sonata-project/admin-bundle 3.50 and will throw an exception in 4.0.
346
     */
347
    public function testGetAdminByAdminCodeWithInvalidChildCode(string $adminId): void
348
    {
349
        $adminMock = $this->createMock(AdminInterface::class);
350
        $adminMock
351
            ->method('hasChild')
352
            ->willReturn(false);
353
        $adminMock->expects($this->never())
354
            ->method('getChild');
355
356
        /** @var MockObject|Pool $poolMock */
357
        $poolMock = $this->getMockBuilder(Pool::class)
358
            ->setConstructorArgs([$this->container, 'Sonata', '/path/to/logo.png'])
359
            ->disableOriginalClone()
360
            ->setMethodsExcept(['getAdminByAdminCode'])
361
            ->getMock();
362
        $poolMock
0 ignored issues
show
Bug introduced by
The method method() does not seem to exist on object<Sonata\AdminBundle\Admin\Pool>.

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
363
            ->method('getInstance')
364
            ->willReturn($adminMock);
365
366
        // NEXT_MAJOR: remove the assertion around getAdminByAdminCode(), remove the "@group" and "@expectedDeprecation" annotations, and uncomment the following line
367
        // $this->expectException(\InvalidArgumentException::class);
368
        $this->assertFalse($poolMock->getAdminByAdminCode($adminId));
369
    }
370
371
    public function getInvalidChildAdminServiceNames()
372
    {
373
        return [
374
            ['admin1|'],
375
            ['admin1|nonexistent_code'],
376
            ['admin1||admin3'],
377
        ];
378
    }
379
380
    /**
381
     * @dataProvider getAdminServiceNamesToCheck
382
     */
383
    public function testHasAdminByAdminCode(string $adminId): void
384
    {
385
        $adminMock = $this->createMock(AdminInterface::class);
386
387
        if (false !== strpos($adminId, '|')) {
388
            $childAdminMock = $this->createMock(AdminInterface::class);
389
            $adminMock
390
                ->method('hasChild')
391
                ->willReturn(true);
392
            $adminMock->expects($this->once())
393
                ->method('getChild')
394
                ->with($this->equalTo('sonata.news.admin.comment'))
395
                ->willReturn($childAdminMock);
396
        } else {
397
            $adminMock->expects($this->never())
398
                ->method('hasChild');
399
            $adminMock->expects($this->never())
400
                ->method('getChild');
401
        }
402
403
        $this->container->set('sonata.news.admin.post', $adminMock);
404
405
        $this->pool->setAdminServiceIds(['sonata.news.admin.post', 'sonata.news.admin.comment']);
406
407
        $this->assertTrue($this->pool->hasAdminByAdminCode($adminId));
408
    }
409
410
    public function getAdminServiceNamesToCheck()
411
    {
412
        return [
413
            ['sonata.news.admin.post'],
414
            ['sonata.news.admin.post|sonata.news.admin.comment'],
415
        ];
416
    }
417
418
    /**
419
     * @dataProvider getNonStringAdminServiceNames
420
     */
421
    public function testHasAdminByAdminCodeWithNonStringCode($adminId): void
422
    {
423
        $this->expectException(\TypeError::class);
424
        $this->pool->hasAdminByAdminCode($adminId);
425
    }
426
427
    /**
428
     * @dataProvider getInvalidAdminServiceNamesToCheck
429
     */
430
    public function testHasAdminByAdminCodeWithInvalidCodes(string $adminId): void
431
    {
432
        $adminMock = $this->createMock(AdminInterface::class);
433
        $adminMock
434
            ->method('hasChild')
435
            ->willReturn(false);
436
        $adminMock->expects($this->never())
437
            ->method('getChild');
438
439
        $this->assertFalse($this->pool->hasAdminByAdminCode($adminId));
440
    }
441
442
    public function getInvalidAdminServiceNamesToCheck()
443
    {
444
        return [
445
            [''],
446
            ['   '],
447
            ['|sonata.news.admin.child_of_empty_code'],
448
        ];
449
    }
450
451
    public function testHasAdminByAdminCodeWithNonExistentCode(): void
452
    {
453
        $this->assertFalse($this->pool->hasAdminByAdminCode('sonata.news.admin.nonexistent_code'));
454
    }
455
456
    /**
457
     * @dataProvider getInvalidChildAdminServiceNamesToCheck
458
     *
459
     * @group legacy
460
     *
461
     * @expectedDeprecation Passing an invalid admin %s argument 1 for Sonata\AdminBundle\Admin\Pool::getAdminByAdminCode() is deprecated since sonata-project/admin-bundle 3.%s and will throw an exception in 4.0.
462
     */
463
    public function testHasAdminByAdminCodeWithInvalidChildCodes(string $adminId): void
464
    {
465
        $adminMock = $this->createMock(AdminInterface::class);
466
        $adminMock
467
            ->method('hasChild')
468
            ->willReturn(false);
469
        $adminMock->expects($this->never())
470
            ->method('getChild');
471
472
        $this->container->set('sonata.news.admin.post', $adminMock);
473
474
        $this->pool->setAdminServiceIds(['sonata.news.admin.post']);
475
476
        $this->assertFalse($this->pool->hasAdminByAdminCode($adminId));
477
    }
478
479
    public function getInvalidChildAdminServiceNamesToCheck(): array
480
    {
481
        return [
482
            ['sonata.news.admin.post|'],
483
            ['sonata.news.admin.post|nonexistent_code'],
484
            ['sonata.news.admin.post||admin3'],
485
        ];
486
    }
487
488
    public function testGetAdminClasses(): void
489
    {
490
        $this->pool->setAdminClasses(['someclass' => 'sonata.user.admin.group1']);
491
        $this->assertSame(['someclass' => 'sonata.user.admin.group1'], $this->pool->getAdminClasses());
492
    }
493
494
    public function testGetAdminGroups(): void
495
    {
496
        $this->pool->setAdminGroups(['adminGroup1' => 'sonata.user.admin.group1']);
497
        $this->assertSame(['adminGroup1' => 'sonata.user.admin.group1'], $this->pool->getAdminGroups());
498
    }
499
500
    public function testGetAdminServiceIds(): void
501
    {
502
        $this->pool->setAdminServiceIds(['sonata.user.admin.group1', 'sonata.user.admin.group2', 'sonata.user.admin.group3']);
503
        $this->assertSame(['sonata.user.admin.group1', 'sonata.user.admin.group2', 'sonata.user.admin.group3'], $this->pool->getAdminServiceIds());
504
    }
505
506
    public function testGetContainer(): void
507
    {
508
        $this->assertInstanceOf(ContainerInterface::class, $this->pool->getContainer());
509
    }
510
511
    /**
512
     * @group legacy
513
     */
514
    public function testTemplate(): void
515
    {
516
        $templateRegistry = $this->prophesize(MutableTemplateRegistryInterface::class);
517
        $templateRegistry->getTemplate('ajax')
518
            ->shouldBeCalledTimes(1)
519
            ->willReturn('Foo.html.twig');
520
521
        $this->pool->setTemplateRegistry($templateRegistry->reveal());
522
523
        $this->assertSame('Foo.html.twig', $this->pool->getTemplate('ajax'));
0 ignored issues
show
Deprecated Code introduced by
The method Sonata\AdminBundle\Admin\Pool::getTemplate() has been deprecated with message: since sonata-project/admin-bundle 3.34, will be dropped in 4.0. Use TemplateRegistry "sonata.admin.global_template_registry" instead

This method has been deprecated. The supplier of the class has supplied an explanatory message.

The explanatory message should give you some clue as to whether and when the method will be removed from the class and what other method or class to use instead.

Loading history...
524
    }
525
526
    /**
527
     * @group legacy
528
     */
529
    public function testSetGetTemplates(): void
530
    {
531
        $templates = [
532
            'ajax' => 'Foo.html.twig',
533
            'layout' => 'Bar.html.twig',
534
        ];
535
536
        $templateRegistry = $this->prophesize(MutableTemplateRegistryInterface::class);
537
        $templateRegistry->setTemplates($templates)
538
            ->shouldBeCalledTimes(1);
539
        $templateRegistry->getTemplates()
540
            ->shouldBeCalledTimes(1)
541
            ->willReturn($templates);
542
543
        $this->pool->setTemplateRegistry($templateRegistry->reveal());
544
545
        $this->pool->setTemplates($templates);
0 ignored issues
show
Deprecated Code introduced by
The method Sonata\AdminBundle\Admin\Pool::setTemplates() has been deprecated with message: since sonata-project/admin-bundle 3.34, will be dropped in 4.0. Use TemplateRegistry "sonata.admin.global_template_registry" instead

This method has been deprecated. The supplier of the class has supplied an explanatory message.

The explanatory message should give you some clue as to whether and when the method will be removed from the class and what other method or class to use instead.

Loading history...
546
547
        $this->assertSame($templates, $this->pool->getTemplates());
0 ignored issues
show
Deprecated Code introduced by
The method Sonata\AdminBundle\Admin\Pool::getTemplates() has been deprecated with message: since sonata-project/admin-bundle 3.34, will be dropped in 4.0. Use TemplateRegistry "sonata.admin.global_template_registry" instead

This method has been deprecated. The supplier of the class has supplied an explanatory message.

The explanatory message should give you some clue as to whether and when the method will be removed from the class and what other method or class to use instead.

Loading history...
548
    }
549
550
    public function testGetTitleLogo(): void
551
    {
552
        $this->assertSame('/path/to/pic.png', $this->pool->getTitleLogo());
553
    }
554
555
    public function testGetTitle(): void
556
    {
557
        $this->assertSame('Sonata Admin', $this->pool->getTitle());
558
    }
559
560
    public function testGetOption(): void
561
    {
562
        $this->assertSame('bar', $this->pool->getOption('foo'));
563
564
        $this->assertNull($this->pool->getOption('non_existent_option'));
565
    }
566
567
    public function testOptionDefault(): void
568
    {
569
        $this->assertSame([], $this->pool->getOption('nonexistantarray', []));
570
    }
571
572
    private function getItemArray(string $serviceId): array
573
    {
574
        return [
575
            'admin' => $serviceId,
576
            'label' => '',
577
            'route' => '',
578
            'route_params' => [],
579
        ];
580
    }
581
}
582