'meet-demo-free-001', 'name' => 'Meet Demo Free', 'email' => 'demo-free@ladill.com', ]); $this->artisan('demo:seed', ['identity' => $user->email, '--plan' => 'free']) ->assertSuccessful(); $org = Organization::query()->where('owner_ref', $user->public_id)->first(); $this->assertNotNull($org); $this->assertTrue((bool) data_get($org->settings, 'demo')); $this->assertTrue((bool) data_get($org->settings, 'onboarded')); $this->assertDatabaseHas('meet_members', [ 'organization_id' => $org->id, 'user_ref' => $user->public_id, 'role' => 'owner', ]); $this->assertSame(1, Branch::query()->where('organization_id', $org->id)->count()); $this->assertSame(2, Room::query()->where('owner_ref', $user->public_id)->count()); $this->assertGreaterThan(0, Session::query()->where('owner_ref', $user->public_id)->count()); $this->assertGreaterThan(0, Participant::query()->where('owner_ref', $user->public_id)->count()); $this->assertTrue( Room::query()->where('owner_ref', $user->public_id)->where('status', 'scheduled')->exists() ); $this->assertTrue( Room::query()->where('owner_ref', $user->public_id)->where('status', 'ended')->exists() ); } public function test_plan_only_varies_volume_and_makes_no_http_calls(): void { $user = User::create([ 'public_id' => 'meet-demo-ent-001', 'name' => 'Meet Demo Ent', 'email' => 'demo-enterprise@ladill.com', ]); Http::fake(); $this->artisan('demo:seed', ['identity' => $user->public_id, '--plan' => 'enterprise']) ->assertSuccessful(); Http::assertNothingSent(); $this->assertSame(3, Branch::query()->where('owner_ref', $user->public_id)->count()); $this->assertSame(6, Room::query()->where('owner_ref', $user->public_id)->count()); } public function test_idempotent_and_reset_is_tenant_scoped(): void { $user = User::create([ 'public_id' => 'meet-demo-pro-001', 'name' => 'Meet Demo Pro', 'email' => 'demo-pro@ladill.com', ]); $other = User::create([ 'public_id' => 'meet-other-001', 'name' => 'Other User', 'email' => 'other@example.com', ]); Organization::create([ 'owner_ref' => $other->public_id, 'name' => 'Other Org', 'slug' => 'other-org', 'timezone' => 'UTC', 'settings' => ['onboarded' => true], ]); $this->artisan('demo:seed', ['identity' => $user->email, '--plan' => 'pro']) ->assertSuccessful(); $rooms = Room::query()->where('owner_ref', $user->public_id)->count(); $this->assertSame(4, $rooms); $this->artisan('demo:seed', ['identity' => $user->email, '--plan' => 'pro']) ->assertSuccessful(); $this->assertSame(4, Room::query()->where('owner_ref', $user->public_id)->count()); $this->artisan('demo:seed', [ 'identity' => $user->email, '--plan' => 'free', '--reset' => true, ])->assertSuccessful(); $this->assertSame(2, Room::query()->where('owner_ref', $user->public_id)->count()); $this->assertSame(1, Member::query()->where('owner_ref', $user->public_id)->count()); $this->assertDatabaseHas('meet_organizations', [ 'owner_ref' => $other->public_id, 'slug' => 'other-org', ]); } public function test_pro_seed_uses_demo_world_business_staff_and_guests(): void { $user = User::create([ 'public_id' => 'meet-demo-pro-continuity', 'name' => 'Meet Demo Pro', 'email' => 'demo-pro@ladill.com', ]); $this->artisan('demo:seed', ['identity' => $user->email, '--plan' => 'pro']) ->assertSuccessful(); $org = Organization::query()->where('owner_ref', $user->public_id)->first(); $this->assertSame(DemoWorld::business('pro')['name'], $org->name); $this->assertDatabaseHas('meet_branches', [ 'organization_id' => $org->id, 'name' => DemoWorld::branches('pro')[0]['name'], ]); $this->assertDatabaseHas('users', ['email' => 'demo-pro-sales@ladill.com']); $this->assertDatabaseHas('meet_members', [ 'organization_id' => $org->id, 'user_ref' => 'demo-pro-sales@ladill.com', 'role' => 'member', ]); $firstGuest = DemoWorld::people(1)[0]; $this->assertTrue( Participant::query() ->where('owner_ref', $user->public_id) ->where('email', $firstGuest['email']) ->exists() ); } }