File tree Expand file tree Collapse file tree 2 files changed +14
-2
lines changed Expand file tree Collapse file tree 2 files changed +14
-2
lines changed Original file line number Diff line number Diff line change @@ -32,7 +32,7 @@ public function handle()
32
32
$ basePath = $ this ->laravel ->basePath ();
33
33
34
34
File::copy (__DIR__ . '/stubs/phpcs.xml ' , $ basePath . '/phpcs.xml ' );
35
- if (File::exists ($ basePath . '/.git ' )) {
35
+ if (File::exists ($ basePath . '/.git/hooks ' )) {
36
36
File::copy (__DIR__ . '/stubs/git-pre-commit ' , $ basePath . '/.git/hooks/pre-commit ' );
37
37
File::chmod ($ basePath . '/.git/hooks/pre-commit ' , 0755 );
38
38
}
Original file line number Diff line number Diff line change 2
2
3
3
namespace LaravelFans \Lint \Tests ;
4
4
5
+ use Illuminate \Support \Facades \File ;
6
+
5
7
class LintPublishCommandTest extends TestCase
6
8
{
7
- public function testHandle ()
9
+ public function testGitNotExists ()
10
+ {
11
+ $ laravelPath = __DIR__ . '/../vendor/orchestra/testbench-core/laravel ' ;
12
+ File::deleteDirectory ($ laravelPath . '/.git/ ' , true );
13
+ $ this ->artisan ('lint:publish ' )->run ();
14
+ $ this ->assertFileExists ($ laravelPath . '/phpcs.xml ' );
15
+ $ this ->assertFileDoesNotExist ($ laravelPath . '/.git/hooks/pre-commit ' );
16
+ }
17
+
18
+ public function testGitExists ()
8
19
{
9
20
$ laravelPath = __DIR__ . '/../vendor/orchestra/testbench-core/laravel ' ;
21
+ File::makeDirectory ($ laravelPath . '/.git/hooks/ ' , 0755 , true );
10
22
$ this ->artisan ('lint:publish ' )->run ();
11
23
$ this ->assertFileExists ($ laravelPath . '/phpcs.xml ' );
12
24
$ this ->assertFileExists ($ laravelPath . '/.git/hooks/pre-commit ' );
You can’t perform that action at this time.
0 commit comments