mirror of
https://github.com/nothingworksinc/ticketbeast.git
synced 2026-01-26 11:14:06 +00:00
153 - Testing a Console Command
This commit is contained in:
27
tests/Feature/InvitePromoterTest.php
Normal file
27
tests/Feature/InvitePromoterTest.php
Normal file
@@ -0,0 +1,27 @@
|
||||
<?php
|
||||
|
||||
namespace Tests\Feature;
|
||||
|
||||
use App\Invitation;
|
||||
use Tests\TestCase;
|
||||
use App\Facades\InvitationCode;
|
||||
use Illuminate\Foundation\Testing\WithFaker;
|
||||
use Illuminate\Foundation\Testing\RefreshDatabase;
|
||||
|
||||
class InvitePromoterTest extends TestCase
|
||||
{
|
||||
use RefreshDatabase;
|
||||
|
||||
/** @test */
|
||||
function inviting_a_promoter_via_the_cli()
|
||||
{
|
||||
InvitationCode::shouldReceive('generate')->andReturn('TESTCODE1234');
|
||||
|
||||
$this->artisan('invite-promoter', ['email' => 'john@example.com']);
|
||||
|
||||
$this->assertEquals(1, Invitation::count());
|
||||
$invitation = Invitation::first();
|
||||
$this->assertEquals('john@example.com', $invitation->email);
|
||||
$this->assertEquals('TESTCODE1234', $invitation->code);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user