seed(); $other = Business::create([ 'slug' => 'other-barbershop', 'name' => 'Other Barbershop', 'timezone' => 'Europe/London', 'currency' => 'GBP', 'locale' => 'en-GB', ]); BusinessDomain::create([ 'businessId' => $other->id, 'hostname' => 'other.test', 'isPrimary' => true, 'isActive' => true, ]); $this->get('http://localhost/') ->assertOk() ->assertSee('Blake Heritage Barbershop') ->assertSee('Classic Haircut') ->assertDontSeeText('Other Barbershop'); $this->get('http://other.test/') ->assertOk() ->assertSee('Other Barbershop') ->assertDontSeeText('Classic Haircut'); } public function test_registration_creates_a_customer_profile_in_the_current_tenant(): void { $this->seed(); $response = $this->withHeaders(['Host' => 'localhost']) ->post('/register', [ 'firstName' => 'Taylor', 'lastName' => 'Member', 'email' => 'taylor@example.test', 'phone' => '020 7000 0000', 'password' => 'password123', 'password_confirmation' => 'password123', ]); $response->assertRedirect(route('customer.dashboard')); $this->assertAuthenticated(); $this->assertDatabaseHas('User', ['email' => 'taylor@example.test']); $this->assertDatabaseHas('CustomerProfile', [ 'email' => 'taylor@example.test', 'isGuest' => 0, 'businessId' => Business::where('slug', 'demo-barbershop')->value('id'), ]); $this->assertSame(1, CustomerProfile::where('email', 'taylor@example.test')->count()); $this->withHeaders(['Host' => 'localhost'])->get('/account')->assertOk()->assertSee('Good to see you, Taylor'); $this->withHeaders(['Host' => 'localhost'])->get('/owner')->assertForbidden(); $this->assertNotNull(User::where('email', 'taylor@example.test')->first()); } }