finish event with log user participation
This commit is contained in:
@@ -507,7 +507,6 @@ class EventsTest extends TestCase
|
||||
/** @test */
|
||||
public function staff_can_add_guest()
|
||||
{
|
||||
$this->withoutExceptionHandling();
|
||||
$user = factory(User::class)->create();
|
||||
$event = factory(Event::class)->create(['user_id' => $user->id]);
|
||||
$this->actingAs($userTwo = factory(User::class)->create(), 'api');
|
||||
@@ -551,11 +550,96 @@ class EventsTest extends TestCase
|
||||
]);
|
||||
}
|
||||
|
||||
// guest_can_invite_another_guest_if_public_event
|
||||
/** @test */
|
||||
public function guest_can_invite_another_guest_if_public_event()
|
||||
{
|
||||
$user = factory(User::class)->create();
|
||||
$event = factory(Event::class)->create(['user_id' => $user->id,'private' => false]);
|
||||
$this->actingAs($userTwo = factory(User::class)->create(), 'api');
|
||||
$event->guests()->attach($userTwo);
|
||||
|
||||
// guest_can_validate_event_participation
|
||||
$nexGuestUser = factory(User::class)->create();
|
||||
|
||||
// guest_can_delete_invitation
|
||||
$response = $this->post('api/events/'.$event->id.'/invite/'.$nexGuestUser->id);
|
||||
|
||||
$event = $event->fresh();
|
||||
|
||||
$this->assertCount(2, $event->guests);
|
||||
$response->assertJson([
|
||||
'data' => [
|
||||
'event_id' => $event->id,
|
||||
'attributes' => [
|
||||
'data' => [
|
||||
'invitations' => [
|
||||
[
|
||||
'data' => [
|
||||
'user_id' => $userTwo->id,
|
||||
],
|
||||
],
|
||||
[
|
||||
'data' => [
|
||||
'user_id' => $nexGuestUser->id,
|
||||
]
|
||||
]
|
||||
],
|
||||
]
|
||||
]
|
||||
]
|
||||
]);
|
||||
}
|
||||
|
||||
/** @test */
|
||||
public function guest_can_validate_event_participation()
|
||||
{
|
||||
$this->withoutExceptionHandling();
|
||||
$this->withoutExceptionHandling();
|
||||
$user = factory(User::class)->create();
|
||||
$event = factory(Event::class)->create(['user_id' => $user->id,'private' => false]);
|
||||
$this->actingAs($userTwo = factory(User::class)->create(), 'api');
|
||||
$event->guests()->attach($userTwo);
|
||||
|
||||
$response = $this->delete('api/events/'.$event->id.'/invite/validation');
|
||||
|
||||
$event = $event->fresh();
|
||||
|
||||
$this->assertCount(1, $event->guests);
|
||||
$response->assertJson([
|
||||
'data' => [
|
||||
'event_id' => $event->id,
|
||||
'attributes' => [
|
||||
'data' => [
|
||||
'invitations' => [
|
||||
[
|
||||
'data' => [
|
||||
'user_id' => $userTwo->id,
|
||||
'attributes' => [
|
||||
'validated_at' => now()->toDateTimeString(),
|
||||
]
|
||||
],
|
||||
],
|
||||
],
|
||||
]
|
||||
]
|
||||
]
|
||||
]);
|
||||
}
|
||||
|
||||
/** @test */
|
||||
public function guest_can_delete_invitation()
|
||||
{
|
||||
$this->withoutExceptionHandling();
|
||||
$user = factory(User::class)->create();
|
||||
$event = factory(Event::class)->create(['user_id' => $user->id,'private' => false]);
|
||||
$this->actingAs($userTwo = factory(User::class)->create(), 'api');
|
||||
$event->guests()->attach($userTwo);
|
||||
|
||||
$response = $this->delete('api/events/'.$event->id.'/invite/delete');
|
||||
|
||||
$event = $event->fresh();
|
||||
|
||||
$response->assertStatus(204);
|
||||
$this->assertCount(0, $event->guests);
|
||||
}
|
||||
|
||||
// owner_can_invite_a_non_user_with_an_email
|
||||
|
||||
|
||||
Reference in New Issue
Block a user