generated from spatie/package-skeleton-laravel
-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
71bd66b
commit afb168a
Showing
6 changed files
with
50 additions
and
26 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,35 @@ | ||
<?php | ||
|
||
use Illuminate\Foundation\Testing\RefreshDatabase; | ||
use Illuminate\Foundation\Testing\WithFaker; | ||
use PHPUnit\Framework\TestCase; | ||
|
||
class LaragenieCommandTest extends TestCase | ||
{ | ||
use RefreshDatabase, WithFaker; | ||
|
||
protected function setUp(): void | ||
{ | ||
parent::setUp(); | ||
} | ||
} | ||
use JoshEmbling\Laragenie\Commands\LaragenieCommand; | ||
use JoshEmbling\Laragenie\Models\Laragenie as LaragenieModel; | ||
|
||
test('welcome choice `q` reverts to userAction when empty string is passed', function () { | ||
$this->artisan(LaragenieCommand::class) | ||
->expectsQuestion('What do you want to do?', 'q') | ||
->expectsQuestion('What is your question for '.config('laragenie.bot.name'), '') | ||
->expectsOutputToContain('You must provide a question.') | ||
->expectsQuestion('Do you want to do something else?', 'x') | ||
->assertExitCode(0); | ||
}); | ||
|
||
test('welcome choice `q` executes userQuestion and fetches from database when existing string is passed', function () { | ||
LaragenieModel::create([ | ||
'question' => 'test', | ||
'answer' => 'This is a test', | ||
]); | ||
|
||
$this->artisan(LaragenieCommand::class) | ||
->expectsQuestion('What do you want to do?', 'q') | ||
->expectsQuestion('What is your question for '.config('laragenie.bot.name'), 'Test') | ||
->expectsOutputToContain('This is a test') | ||
->expectsQuestion('Do you want to do something else?', 'x') | ||
->assertExitCode(0); | ||
}); | ||
|
||
test('welcome choice `o` returns a string and reverts to userAction', function () { | ||
$this->artisan(LaragenieCommand::class) | ||
->expectsQuestion('What do you want to do?', 'o') | ||
->expectsOutputToContain('You can contact @joshembling on Github to suggest another feature.') | ||
->expectsQuestion('Do you want to do something else?', 'x') | ||
->assertExitCode(0); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters