-
-
Notifications
You must be signed in to change notification settings - Fork 74
Expand file tree
/
Copy pathSpotlightCommandDependencyTest.php
More file actions
53 lines (46 loc) · 1.64 KB
/
SpotlightCommandDependencyTest.php
File metadata and controls
53 lines (46 loc) · 1.64 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
<?php declare(strict_types=1);
namespace LivewireUI\Spotlight\Tests;
use Generator;
use LivewireUI\Spotlight\SpotlightCommandDependency;
class SpotlightCommandDependencyTest extends \PHPUnit\Framework\TestCase
{
/**
* @test
* @dataProvider dependencyProvider
*/
public function it_can_be_turned_into_an_array(string $identifier, callable $configureDependency, array $expected): void
{
$commandDependency = SpotlightCommandDependency::make($identifier);
$configureDependency($commandDependency);
self::assertEquals($expected, $commandDependency->toArray());
}
public function dependencyProvider(): Generator
{
yield from [
'no explicit type' => [
'::id::',
function (SpotlightCommandDependency $dependency) {
$dependency->setPlaceholder('::placeholder-1::');
},
[
'id' => '::id::',
'placeholder' => '::placeholder-1::',
'type' => SpotlightCommandDependency::SEARCH,
]
],
'provide explicit type' => [
'::id::',
function (SpotlightCommandDependency $dependency) {
$dependency
->setType(SpotlightCommandDependency::INPUT)
->setPlaceholder('::placeholder-2::');
},
[
'id' => '::id::',
'placeholder' => '::placeholder-2::',
'type' => SpotlightCommandDependency::INPUT,
]
]
];
}
}