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