@@ -535,15 +535,15 @@ public function testGenerateCloneCommand(): void
535535 public function testGenerateCloneCommandWithCommitHash (): void
536536 {
537537 $ repositoryName = 'test-clone-commit- ' . \uniqid ();
538+ $ directory = '/tmp/test-clone-commit- ' . \uniqid ();
538539 $ this ->vcsAdapter ->createRepository (static ::$ owner , $ repositoryName , false );
539-
540+
540541 try {
541542 $ this ->vcsAdapter ->createFile (static ::$ owner , $ repositoryName , 'README.md ' , '# Test ' );
542-
543+
543544 $ commit = $ this ->vcsAdapter ->getLatestCommit (static ::$ owner , $ repositoryName , static ::$ defaultBranch );
544545 $ commitHash = $ commit ['commitHash ' ];
545-
546- $ directory = '/tmp/test-clone-commit- ' . \uniqid ();
546+
547547 $ command = $ this ->vcsAdapter ->generateCloneCommand (
548548 static ::$ owner ,
549549 $ repositoryName ,
@@ -552,16 +552,19 @@ public function testGenerateCloneCommandWithCommitHash(): void
552552 $ directory ,
553553 '* '
554554 );
555-
555+
556556 $ this ->assertIsString ($ command );
557557 $ this ->assertStringContainsString ('sparse-checkout ' , $ command );
558-
558+
559559 $ output = [];
560560 \exec ($ command . ' 2>&1 ' , $ output , $ exitCode );
561561 $ this ->assertSame (0 , $ exitCode , implode ("\n" , $ output ));
562562 $ this ->assertFileExists ($ directory . '/README.md ' );
563563 } finally {
564564 $ this ->vcsAdapter ->deleteRepository (static ::$ owner , $ repositoryName );
565+ if (\is_dir ($ directory )) {
566+ \exec ('rm -rf ' . escapeshellarg ($ directory ));
567+ }
565568 }
566569 }
567570
0 commit comments