1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
namespace Acacha\AdminLTETemplateLaravel\Tests; |
4
|
|
|
|
5
|
|
|
use Acacha\AdminLTETemplateLaravel\Console\InstallCommand; |
6
|
|
|
use Symfony\Component\Console\Application; |
7
|
|
|
use Symfony\Component\Console\Tester\CommandTester; |
8
|
|
|
|
9
|
|
|
/** |
10
|
|
|
* Class InstallCommandTest. |
11
|
|
|
*/ |
12
|
|
|
class InstallCommandTest extends \PHPUnit_Framework_TestCase |
13
|
|
|
{ |
14
|
|
|
/** |
15
|
|
|
* Test execution. |
16
|
|
|
*/ |
17
|
|
|
public function testExecute() |
18
|
|
|
{ |
19
|
|
|
$application = new Application(); |
20
|
|
|
$application->add(new InstallCommand()); |
21
|
|
|
|
22
|
|
|
$command = $application->find('install'); |
23
|
|
|
$commandTester = new CommandTester($command); |
24
|
|
|
$commandTester->execute([ |
25
|
|
|
'command' => $command->getName(). |
26
|
|
|
'--force', |
27
|
|
|
]); |
28
|
|
|
|
29
|
|
|
$this->assertTrue( |
30
|
|
|
$this->fileHasContent('/composer.json', 'acacha/admin-lte-template-laravel')); |
31
|
|
|
|
32
|
|
|
$this->assertTrue( |
33
|
|
|
$this->fileHasContent( |
34
|
|
|
'/config/app.php', |
35
|
|
|
'Acacha\AdminLTETemplateLaravel\Providers\AdminLTETemplateServiceProvider::class' |
36
|
|
|
)); |
37
|
|
|
|
38
|
|
|
$this->assertTrue( |
39
|
|
|
$this->fileHasContent( |
40
|
|
|
'/config/app.php', |
41
|
|
|
'Acacha\AdminLTETemplateLaravel\Facades\AdminLTE::class' |
42
|
|
|
)); |
43
|
|
|
|
44
|
|
|
$this->assertFileExists('app/Http/Controllers/HomeController.php'); |
45
|
|
|
|
46
|
|
|
$this->assertTrue( |
47
|
|
|
$this->fileHasContent( |
48
|
|
|
'/app/Http/Controllers/Auth/RegisterController.php', |
49
|
|
|
"'terms' => 'required'," |
50
|
|
|
)); |
51
|
|
|
|
52
|
|
|
$this->assertFileExists('public/img'); |
53
|
|
|
$this->assertFileExists('public/img/AcachaAdminLTE.png'); |
54
|
|
|
$this->assertFileExists('public/css/AdminLTE.css'); |
55
|
|
|
$this->assertFileExists('public/js/adminlte-app.js'); |
56
|
|
|
$this->assertFileExists('public/plugins'); |
57
|
|
|
$this->assertFileExists('public/fonts'); |
58
|
|
|
$this->assertFileExists('resources/views/auth'); |
59
|
|
|
$this->assertFileExists('resources/views/auth/emails'); |
60
|
|
|
$this->assertFileExists('resources/views/errors/404.blade.php'); |
61
|
|
|
$this->assertFileExists('resources/views/layouts'); |
62
|
|
|
$this->assertFileExists('resources/views/home.blade.php'); |
63
|
|
|
$this->assertTrue( |
64
|
|
|
$this->fileHasContent( |
65
|
|
|
'/resources/views/welcome.blade.php', |
66
|
|
|
"extends('layouts.landing')" |
67
|
|
|
)); |
68
|
|
|
$this->assertFileExists('resources/assets/less'); |
69
|
|
|
$this->assertTrue( |
70
|
|
|
$this->fileHasContent( |
71
|
|
|
'/gulpfile.js', |
72
|
|
|
"mix.less('admin-lte/AdminLTE.less');" |
73
|
|
|
)); |
74
|
|
|
$this->assertFileExists('tests/AcachaAdminLTELaravelTest.php'); |
75
|
|
|
$this->assertTrue( |
76
|
|
|
$this->fileHasContent( |
77
|
|
|
'/phpunit.xml', |
78
|
|
|
'sqlite' |
79
|
|
|
)); |
80
|
|
|
$this->assertFileExists('resources/lang/vendor/adminlte_lang'); |
81
|
|
|
$this->assertFileExists('config/gravatar.php'); |
82
|
|
|
} |
83
|
|
|
|
84
|
|
|
/** |
85
|
|
|
* Test if file has content. |
86
|
|
|
* |
87
|
|
|
* @param $file |
88
|
|
|
* @param $content |
89
|
|
|
* |
90
|
|
|
* @return bool |
91
|
|
|
*/ |
92
|
|
|
private function fileHasContent($file, $content) |
93
|
|
|
{ |
94
|
|
|
return strpos(file_get_contents(getcwd().$file), $content) != false; |
|
|
|
|
95
|
|
|
} |
96
|
|
|
} |
97
|
|
|
|