forked from dotkernel/dot-navigation
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathArrayProviderTest.php
More file actions
46 lines (39 loc) · 1.32 KB
/
ArrayProviderTest.php
File metadata and controls
46 lines (39 loc) · 1.32 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
<?php
declare(strict_types=1);
namespace DotTest\Navigation\Provider;
use Dot\Navigation\NavigationContainer;
use Dot\Navigation\Provider\ArrayProvider;
use PHPUnit\Framework\TestCase;
class ArrayProviderTest extends TestCase
{
public function testWillCreateArrayProvider(): void
{
$provider = new ArrayProvider();
$this->assertSame(ArrayProvider::class, $provider::class);
}
public function testAccessors(): void
{
$provider = new ArrayProvider();
$this->assertFalse($provider->hasItems());
$provider->setItems(['test']);
$this->assertTrue($provider->hasItems());
$this->assertSame(['test'], $provider->getItems());
}
public function testGetContainer(): void
{
$pageSpecs = [
[
'pages' => [
['attributes' => ['attr' => 'attribute #0'], 'options' => ['opt' => 'option #0']],
['attributes' => ['attr' => 'attribute #1'], 'options' => ['opt' => 'option #1']],
],
],
];
$provider = new ArrayProvider([
'items' => $pageSpecs,
]);
$container = $provider->getContainer();
$this->assertSame(NavigationContainer::class, $container::class);
$this->assertCount(2, $container->getChildren());
}
}