1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
declare(strict_types=1); |
4
|
|
|
|
5
|
|
|
namespace Tests\Unit; |
6
|
|
|
|
7
|
|
|
use Illuminate\Contracts\Console\Kernel; |
8
|
|
|
use Illuminate\Http\Request; |
9
|
|
|
|
10
|
|
|
use function array_keys; |
11
|
|
|
|
12
|
|
|
class ServiceProviderTest extends TestCase |
|
|
|
|
13
|
|
|
{ |
14
|
|
|
/** @test */ |
15
|
|
|
public function check_if_commands_registered() |
16
|
|
|
{ |
17
|
|
|
$commands = [ |
18
|
|
|
'command.lodash.clear-all' => 'clear-all', |
19
|
|
|
'command.lodash.db.clear' => 'db:clear', |
20
|
|
|
'command.lodash.db.dump' => 'db:dump', |
21
|
|
|
'command.lodash.db.restore' => 'db:restore', |
22
|
|
|
'command.lodash.log.clear' => 'log:clear', |
23
|
|
|
'command.lodash.user.add' => 'user:add', |
24
|
|
|
'command.lodash.user.password' => 'user:password', |
25
|
|
|
]; |
26
|
|
|
|
27
|
|
|
$registered = $this->app[Kernel::class]->all(); |
28
|
|
|
foreach ($commands as $command => $name) { |
29
|
|
|
$this->assertTrue($this->app->bound($command)); |
30
|
|
|
$this->assertContains($name, array_keys($registered)); |
31
|
|
|
} |
32
|
|
|
} |
33
|
|
|
|
34
|
|
|
/** @test */ |
35
|
|
|
public function check_if_request_has_macros() |
36
|
|
|
{ |
37
|
|
|
$this->assertTrue(Request::hasMacro('getInt')); |
38
|
|
|
$this->assertTrue(Request::hasMacro('getBool')); |
39
|
|
|
$this->assertTrue(Request::hasMacro('getFloat')); |
40
|
|
|
$this->assertTrue(Request::hasMacro('getString')); |
41
|
|
|
} |
42
|
|
|
|
43
|
|
|
/** @test */ |
44
|
|
|
public function check_blade_directives() |
45
|
|
|
{ |
46
|
|
|
$directives = [ |
47
|
|
|
'datetime', |
48
|
|
|
'plural', |
49
|
|
|
]; |
50
|
|
|
|
51
|
|
|
$registered = app('blade.compiler')->getCustomDirectives(); |
52
|
|
|
foreach ($directives as $directive) { |
53
|
|
|
$this->assertContains($directive, array_keys($registered)); |
54
|
|
|
} |
55
|
|
|
} |
56
|
|
|
} |
57
|
|
|
|