start guest invitation on event
This commit is contained in:
@@ -386,6 +386,96 @@ class EventsTest extends TestCase
|
||||
$response->assertStatus(403);
|
||||
}
|
||||
|
||||
/** @test */
|
||||
public function owner_can_invite_user_to_an_event()
|
||||
{
|
||||
$this->withoutExceptionHandling();
|
||||
$this->actingAs($user = factory(User::class)->create(), 'api');
|
||||
$event = factory(Event::class)->create(['user_id' => $user->id]);
|
||||
$userTwo = factory(User::class)->create();
|
||||
|
||||
$response = $this->get('api/events/'.$event->id.'/invite/'.$userTwo->id);
|
||||
$response->assertStatus(200);
|
||||
$response->assertJson([
|
||||
'data' => [
|
||||
'event_id' => $event->id,
|
||||
'attributes' => [
|
||||
'data' => [
|
||||
'invitations' => [
|
||||
[
|
||||
'data' => [
|
||||
'user_id' => $userTwo->id,
|
||||
]
|
||||
]
|
||||
],
|
||||
]
|
||||
]
|
||||
]
|
||||
]);
|
||||
}
|
||||
|
||||
/** @test */
|
||||
public function owner_can_remove_invitation()
|
||||
{
|
||||
$this->withoutExceptionHandling();
|
||||
$this->actingAs($user = factory(User::class)->create(), 'api');
|
||||
$event = factory(Event::class)->create(['user_id' => $user->id]);
|
||||
$userTwo = factory(User::class)->create();
|
||||
$event->guests()->attach($userTwo);
|
||||
|
||||
$response = $this->delete('api/events/'.$event->id.'/invite/'.$userTwo->id);
|
||||
|
||||
$event = $event->fresh();
|
||||
|
||||
$this->assertCount(0, $event->guests);
|
||||
|
||||
$response->assertStatus(204);
|
||||
}
|
||||
|
||||
/** @test */
|
||||
public function owner_can_add_guest_to_staff_event()
|
||||
{
|
||||
$this->withoutExceptionHandling();
|
||||
$this->actingAs($user = factory(User::class)->create(), 'api');
|
||||
$event = factory(Event::class)->create(['user_id' => $user->id]);
|
||||
$userTwo = factory(User::class)->create();
|
||||
$event->guests()->attach($userTwo);
|
||||
|
||||
$response = $this->get('api/events/'.$event->id.'/staff/'.$userTwo->id);
|
||||
$response->assertStatus(200);
|
||||
$response->assertJson([
|
||||
'data' => [
|
||||
'event_id' => $event->id,
|
||||
'attributes' => [
|
||||
'data' => [
|
||||
'invitations' => [
|
||||
[
|
||||
'data' => [
|
||||
'user_id' => $userTwo->id,
|
||||
'attributes' => [
|
||||
'is_staff' => true,
|
||||
]
|
||||
|
||||
],
|
||||
'links' => [
|
||||
'self' => url('/users/'.$userTwo->id),
|
||||
],
|
||||
]
|
||||
],
|
||||
]
|
||||
]
|
||||
]
|
||||
]);
|
||||
}
|
||||
|
||||
// owner_can_remove_guest_to_staff_event
|
||||
|
||||
// staff_can_add_guest
|
||||
|
||||
// guest_can_validate_event_participation
|
||||
|
||||
// guest_can_delete_invitation
|
||||
|
||||
private function data()
|
||||
{
|
||||
return [
|
||||
|
||||
Reference in New Issue
Block a user