mirror of
https://github.com/nothingworksinc/ticketbeast.git
synced 2026-02-07 14:50:25 +00:00
104 - Adding a Valid Concert
This commit is contained in:
@@ -30,4 +30,67 @@ class AddConcertTest extends TestCase
|
||||
$response->assertStatus(302);
|
||||
$response->assertRedirect('/login');
|
||||
}
|
||||
|
||||
/** @test */
|
||||
function adding_a_valid_concert()
|
||||
{
|
||||
$this->disableExceptionHandling();
|
||||
|
||||
$user = factory(User::class)->create();
|
||||
|
||||
$response = $this->actingAs($user)->post('/backstage/concerts', [
|
||||
'title' => 'No Warning',
|
||||
'subtitle' => 'with Cruel Hand and Backtrack',
|
||||
'additional_information' => "You must be 19 years of age to attend this concert.",
|
||||
'date' => '2017-11-18',
|
||||
'time' => '8:00pm',
|
||||
'venue' => 'The Mosh Pit',
|
||||
'venue_address' => '123 Fake St.',
|
||||
'city' => 'Laraville',
|
||||
'state' => 'ON',
|
||||
'zip' => '12345',
|
||||
'ticket_price' => '32.50',
|
||||
'ticket_quantity' => '75',
|
||||
]);
|
||||
|
||||
tap(Concert::first(), function ($concert) use ($response) {
|
||||
$response->assertStatus(302);
|
||||
$response->assertRedirect("/concerts/{$concert->id}");
|
||||
|
||||
$this->assertEquals('No Warning', $concert->title);
|
||||
$this->assertEquals('with Cruel Hand and Backtrack', $concert->subtitle);
|
||||
$this->assertEquals("You must be 19 years of age to attend this concert.", $concert->additional_information);
|
||||
$this->assertEquals(Carbon::parse('2017-11-18 8:00pm'), $concert->date);
|
||||
$this->assertEquals('The Mosh Pit', $concert->venue);
|
||||
$this->assertEquals('123 Fake St.', $concert->venue_address);
|
||||
$this->assertEquals('Laraville', $concert->city);
|
||||
$this->assertEquals('ON', $concert->state);
|
||||
$this->assertEquals('12345', $concert->zip);
|
||||
$this->assertEquals(3250, $concert->ticket_price);
|
||||
$this->assertEquals(75, $concert->ticketsRemaining());
|
||||
});
|
||||
}
|
||||
|
||||
/** @test */
|
||||
function guests_cannot_add_new_concerts()
|
||||
{
|
||||
$response = $this->post('/backstage/concerts', [
|
||||
'title' => 'No Warning',
|
||||
'subtitle' => 'with Cruel Hand and Backtrack',
|
||||
'additional_information' => "You must be 19 years of age to attend this concert.",
|
||||
'date' => '2017-11-18',
|
||||
'time' => '8:00pm',
|
||||
'venue' => 'The Mosh Pit',
|
||||
'venue_address' => '123 Fake St.',
|
||||
'city' => 'Laraville',
|
||||
'state' => 'ON',
|
||||
'zip' => '12345',
|
||||
'ticket_price' => '32.50',
|
||||
'ticket_quantity' => '75',
|
||||
]);
|
||||
|
||||
$response->assertStatus(302);
|
||||
$response->assertRedirect('/login');
|
||||
$this->assertEquals(0, Concert::count());
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user