mirror of
https://github.com/nothingworksinc/ticketbeast.git
synced 2026-03-10 10:02:36 +00:00
114 - The First Update Test
This commit is contained in:
@@ -81,4 +81,54 @@ class EditConcertTest extends TestCase
|
|||||||
$response->assertStatus(302);
|
$response->assertStatus(302);
|
||||||
$response->assertRedirect('/login');
|
$response->assertRedirect('/login');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** @test */
|
||||||
|
function promoters_can_edit_their_own_unpublished_concerts()
|
||||||
|
{
|
||||||
|
$this->disableExceptionHandling();
|
||||||
|
|
||||||
|
$user = factory(User::class)->create();
|
||||||
|
$concert = factory(Concert::class)->create([
|
||||||
|
'user_id' => $user->id,
|
||||||
|
'title' => 'Old title',
|
||||||
|
'subtitle' => 'Old subtitle',
|
||||||
|
'additional_information' => 'Old additional information',
|
||||||
|
'date' => Carbon::parse('2017-01-01 5:00pm'),
|
||||||
|
'venue' => 'Old venue',
|
||||||
|
'venue_address' => 'Old address',
|
||||||
|
'city' => 'Old city',
|
||||||
|
'state' => 'Old state',
|
||||||
|
'zip' => '00000',
|
||||||
|
'ticket_price' => 2000,
|
||||||
|
]);
|
||||||
|
$this->assertFalse($concert->isPublished());
|
||||||
|
|
||||||
|
$response = $this->actingAs($user)->patch("/backstage/concerts/{$concert->id}", [
|
||||||
|
'title' => 'New title',
|
||||||
|
'subtitle' => 'New subtitle',
|
||||||
|
'additional_information' => 'New additional information',
|
||||||
|
'date' => '2018-12-12',
|
||||||
|
'time' => '8:00pm',
|
||||||
|
'venue' => 'New venue',
|
||||||
|
'venue_address' => 'New address',
|
||||||
|
'city' => 'New city',
|
||||||
|
'state' => 'New state',
|
||||||
|
'zip' => '99999',
|
||||||
|
'ticket_price' => '72.50',
|
||||||
|
]);
|
||||||
|
|
||||||
|
$response->assertRedirect("/backstage/concerts");
|
||||||
|
tap($concert->fresh(), function ($concert) {
|
||||||
|
$this->assertEquals('New title', $concert->title);
|
||||||
|
$this->assertEquals('New subtitle', $concert->subtitle);
|
||||||
|
$this->assertEquals('New additional information', $concert->additional_information);
|
||||||
|
$this->assertEquals(Carbon::parse('2018-12-12 8:00pm'), $concert->date);
|
||||||
|
$this->assertEquals('New venue', $concert->venue);
|
||||||
|
$this->assertEquals('New address', $concert->venue_address);
|
||||||
|
$this->assertEquals('New city', $concert->city);
|
||||||
|
$this->assertEquals('New state', $concert->state);
|
||||||
|
$this->assertEquals('99999', $concert->zip);
|
||||||
|
$this->assertEquals(7250, $concert->ticket_price);
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user