-
-
Notifications
You must be signed in to change notification settings - Fork 74
Expand file tree
/
Copy pathSpotlightCommandDependenciesTest.php
More file actions
62 lines (54 loc) · 1.82 KB
/
SpotlightCommandDependenciesTest.php
File metadata and controls
62 lines (54 loc) · 1.82 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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
<?php declare(strict_types=1);
namespace LivewireUI\Spotlight\Tests;
use LivewireUI\Spotlight\SpotlightCommandDependencies;
use LivewireUI\Spotlight\SpotlightCommandDependency;
class SpotlightCommandDependenciesTest extends \PHPUnit\Framework\TestCase
{
/** @test */
public function it_is_empty_by_default(): void
{
$dependencies = new SpotlightCommandDependencies();
self::assertEquals([], $dependencies->toArray());
}
/** @test */
public function it_correctly_serializes_for_a_single_dependency(): void
{
$dependencies = SpotlightCommandDependencies::collection()
->add(
SpotlightCommandDependency::make('::id-1::')
->setPlaceholder('::placeholder-1::')
);
self::assertEquals([
[
'id' => '::id-1::',
'placeholder' => '::placeholder-1::',
'type' => 'search',
]
], $dependencies->toArray());
}
/** @test */
public function it_returns_the_dependencies_in_reversed_order(): void
{
$dependencies = SpotlightCommandDependencies::collection()
->add(
SpotlightCommandDependency::make('::id-1::')
->setPlaceholder('::placeholder-1::')
)
->add(
SpotlightCommandDependency::make('::id-2::')
->setPlaceholder('::placeholder-2::')
);
self::assertEquals([
[
'id' => '::id-2::',
'placeholder' => '::placeholder-2::',
'type' => 'search',
],
[
'id' => '::id-1::',
'placeholder' => '::placeholder-1::',
'type' => 'search',
],
], $dependencies->toArray());
}
}