mock(CrmService::class); $crmMock->shouldReceive('unsubscribeCustomer')->andReturn(true); $this->seed(ContentSeeder::class); View::share('PageList', Page::getCached() ->mapWithKeys(fn ($page) => [ $page->slug->value() => $page, ])); Cache::flush(); $hashcode = Uuid::uuid4()->toString(); // WHEN $response = $this->get('/unsubscribe?hashcode=' . $hashcode); // THEN $response->assertStatus(200); }); it('redirects when hashcode is missing', function () { // GIVEN /** @var \Tests\TestCase $this */ $this->seed(ContentSeeder::class); View::share('PageList', Page::getCached() ->mapWithKeys(fn ($page) => [ $page->slug->value() => $page, ])); Cache::flush(); // WHEN $response = $this->get('/unsubscribe'); // THEN $response->assertStatus(302); }); });