mirror of
https://github.com/nothingworksinc/ticketbeast.git
synced 2026-02-08 12:50:35 +00:00
(add template and routing for message attendees form)
This commit is contained in:
53
tests/Feature/Backstage/MessageAttendeesTest.php
Normal file
53
tests/Feature/Backstage/MessageAttendeesTest.php
Normal file
@@ -0,0 +1,53 @@
|
||||
<?php
|
||||
|
||||
namespace Tests\Feature\Backstage;
|
||||
|
||||
use App\User;
|
||||
use ConcertFactory;
|
||||
use Tests\TestCase;
|
||||
use Illuminate\Foundation\Testing\DatabaseMigrations;
|
||||
|
||||
class MessageAttendeesTest extends TestCase
|
||||
{
|
||||
use DatabaseMigrations;
|
||||
|
||||
/** @test */
|
||||
function a_promoter_can_view_the_message_form_for_their_own_concert()
|
||||
{
|
||||
$this->disableExceptionHandling();
|
||||
|
||||
$user = factory(User::class)->create();
|
||||
$concert = ConcertFactory::createPublished([
|
||||
'user_id' => $user->id,
|
||||
]);
|
||||
|
||||
$response = $this->actingAs($user)->get("/backstage/concerts/{$concert->id}/messages/new");
|
||||
|
||||
$response->assertStatus(200);
|
||||
$response->assertViewIs('backstage.concert-messages.new');
|
||||
$this->assertTrue($response->data('concert')->is($concert));
|
||||
}
|
||||
|
||||
/** @test */
|
||||
function a_promoter_cannot_view_the_message_form_for_another_concert()
|
||||
{
|
||||
$user = factory(User::class)->create();
|
||||
$concert = ConcertFactory::createPublished([
|
||||
'user_id' => factory(User::class)->create(),
|
||||
]);
|
||||
|
||||
$response = $this->actingAs($user)->get("/backstage/concerts/{$concert->id}/messages/new");
|
||||
|
||||
$response->assertStatus(404);
|
||||
}
|
||||
|
||||
/** @test */
|
||||
function a_guest_cannot_view_the_message_form_for_any_concert()
|
||||
{
|
||||
$concert = ConcertFactory::createPublished();
|
||||
|
||||
$response = $this->get("/backstage/concerts/{$concert->id}/messages/new");
|
||||
|
||||
$response->assertRedirect('/login');
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user