From 9b5f693d17b5ccaf08eb1258ee7f01ddc44fa0a7 Mon Sep 17 00:00:00 2001 From: Milwad Date: Sat, 6 Apr 2024 19:31:12 +0330 Subject: [PATCH] Update LaravelStubTest.php --- tests/Feature/LaravelStubTest.php | 26 +++++++++++++++----------- 1 file changed, 15 insertions(+), 11 deletions(-) diff --git a/tests/Feature/LaravelStubTest.php b/tests/Feature/LaravelStubTest.php index dbd861c..561ecc2 100644 --- a/tests/Feature/LaravelStubTest.php +++ b/tests/Feature/LaravelStubTest.php @@ -2,6 +2,10 @@ use Binafy\LaravelStub\Facades\LaravelStub; +use function PHPUnit\Framework\assertFileDoesNotExist; +use function PHPUnit\Framework\assertFileExists; +use function PHPUnit\Framework\assertTrue; + test('generate stub successfully with all options', function () { $stub = __DIR__ . '/test.stub'; @@ -16,31 +20,31 @@ ->ext('php') ->generate(); - \PHPUnit\Framework\assertTrue($generate); - \PHPUnit\Framework\assertFileExists(__DIR__ . '/../App/new-test.php'); - \PHPUnit\Framework\assertFileDoesNotExist(__DIR__ . '/../App/test.stub'); + assertTrue($generate); + assertFileExists(__DIR__ . '/../App/new-test.php'); + assertFileDoesNotExist(__DIR__ . '/../App/test.stub'); }); test('throw exception when stub path is invalid', function () { - $generate = LaravelStub::from('test.stub') + LaravelStub::from('test.stub') ->to(__DIR__ . '/../App') ->name('new-test') ->ext('php') ->generate(); - \PHPUnit\Framework\assertFileDoesNotExist(__DIR__ . '/../App/new-test.php'); - \PHPUnit\Framework\assertFileExists(__DIR__ . '/../App/test.stub'); + assertFileDoesNotExist(__DIR__ . '/../App/new-test.php'); + assertFileExists(__DIR__ . '/../App/test.stub'); })->expectExceptionMessage('The stub file does not exist, please enter a valid path.'); test('throw exception when destination path is invalid', function () { - $generate = LaravelStub::from(__DIR__ . '/test.stub') + LaravelStub::from(__DIR__ . '/test.stub') ->to('App') ->name('new-test') ->ext('php') ->generate(); - \PHPUnit\Framework\assertFileDoesNotExist(__DIR__ . '/../App/new-test.php'); - \PHPUnit\Framework\assertFileExists(__DIR__ . '/../App/test.stub'); + assertFileDoesNotExist(__DIR__ . '/../App/new-test.php'); + assertFileExists(__DIR__ . '/../App/test.stub'); })->expectExceptionMessage('The given folder path is not valid.'); test('download the stub file', function () { @@ -58,6 +62,6 @@ ->download(); expect($downloadInstance)->toBeInstanceOf(\Symfony\Component\HttpFoundation\BinaryFileResponse::class); - \PHPUnit\Framework\assertFileExists(__DIR__ . '/../App/new-test.php'); - \PHPUnit\Framework\assertFileDoesNotExist(__DIR__ . '/../App/test.stub'); + assertFileExists(__DIR__ . '/../App/new-test.php'); + assertFileDoesNotExist(__DIR__ . '/../App/test.stub'); });