File tree Expand file tree Collapse file tree 2 files changed +5
-11
lines changed Expand file tree Collapse file tree 2 files changed +5
-11
lines changed Original file line number Diff line number Diff line change 1313namespace App \Support ;
1414
1515use Exception ;
16+ use Github \Api \CurrentUser ;
1617use Github \Client as GithubClient ;
1718use Illuminate \Support \Facades \File ;
1819
@@ -38,15 +39,7 @@ public function isValidSourceDirectory(string $param): bool
3839 public function isValidTargetDirectory (string $ param ): bool
3940 {
4041 if (File::exists ($ param )) {
41- if (!File::isDirectory ($ param )) {
42- return false ;
43- }
44-
45- if (!empty (File::allFiles ($ param ))) {
46- return false ;
47- }
48-
49- return true ;
42+ return File::isDirectory ($ param );
5043 }
5144
5245 mkdir ($ param , 0700 , true );
@@ -86,6 +79,8 @@ public function isValidGithubAccessToken(string $githubAccessToken): bool
8679 try {
8780 $ githubClient = new GithubClient ();
8881 $ githubClient ->authenticate ($ githubAccessToken , null , GithubClient::AUTH_ACCESS_TOKEN );
82+
83+ /** @var $user CurrentUser */
8984 $ user = $ githubClient ->api ('me ' );
9085 $ me = $ user ->show ();
9186
Original file line number Diff line number Diff line change @@ -35,12 +35,11 @@ public function testIsValidTargetDirectory()
3535 $ validator = new Validator ();
3636 $ targetDirectory = env ('TARGET_DIRECTORY ' );
3737 $ this ->assertTrue (File::exists ($ targetDirectory ));
38- $ this ->assertEmpty (File::allFiles ($ targetDirectory ));
3938
4039 $ this ->assertTrue ($ validator ->isValidTargetDirectory ($ targetDirectory ));
4140
4241 touch ($ targetDirectory .'/test ' );
43- $ this ->assertFalse ($ validator ->isValidTargetDirectory ($ targetDirectory ));
42+ $ this ->assertTrue ($ validator ->isValidTargetDirectory ($ targetDirectory ));
4443 unlink ($ targetDirectory .'/test ' );
4544
4645 rmdir ($ targetDirectory );
You can’t perform that action at this time.
0 commit comments