Comments & Discussion
LA
@Povilas, test_guest_registers_to_activity() fails to send notification because User::find(1) is different to Test User. User #1 is a random user created by ActivityFactory, User #2 matches with Test User => test@test.com. So one way to fix this test would be to replace User::find(1) with User::find(2).
JB
hye or Notification::assertSentTo(User::where('email', 'test@test.com')->first(), RegisteredToActivityNotification::class);
T
Hi,
Test "test_shows_already_registered_when_user_is_registered_to_activity()" is failing with a large output, and the end message is:
View [activities.show] not found. at tests\Feature\RegisterActivityTest.php:35 31▕ 32▕ $response = $this->actingAs($user)->get(route('activity.show', $activity)); 33▕ 34▕ $response->assertSeeText('You have already registered.'); ➜ 35▕ $response->assertDontSeeText('Register to Activity'); 36▕ } 37▕ 38▕ public function test_authenticated_user_can_register_to_activity() 39▕ { Tests: 1 failed, 5 passed (17 assertions) Duration: 2.71s
The odd thing is that the previous test makes use of the same route without any issue, so it's proof that
get(route('activity.show', $activity));
works as intended;
T
aritsan need fix it to artisan in this line:
php aritsan make:test RegisterActivityTest