(string) Str::uuid(), 'name' => 'A', 'email' => 'a+'.uniqid().'@x.com']); } public function test_settings_page_renders(): void { $this->actingAs($this->user())->get(route('account.settings'))->assertOk()->assertSee('Hosting notifications'); } public function test_team_page_renders_with_owner(): void { $u = $this->user(); $this->actingAs($u)->get(route('account.team'))->assertOk()->assertSee('Owner')->assertSee($u->email); } public function test_team_invite_creates_member(): void { $u = $this->user(); $this->actingAs($u)->post(route('account.team.store'), ['email' => 'mate@x.com', 'role' => 'member']) ->assertRedirect(); $this->assertDatabaseHas('email_team_members', ['account_id' => $u->id, 'email' => 'mate@x.com', 'status' => 'invited']); } public function test_developers_page_and_token_lifecycle(): void { $u = $this->user(); $this->actingAs($u)->get(route('account.developers'))->assertOk()->assertSee('Create a token'); $this->actingAs($u)->post(route('account.developers.store'), ['name' => 'CI']) ->assertRedirect()->assertSessionHas('new_token'); $this->assertSame(1, $u->tokens()->count()); } public function test_billing_page_renders(): void { $w = Mockery::mock(WalletPaymentService::class); $w->shouldReceive('balanceMinor')->andReturn(5000); $this->app->instance(WalletPaymentService::class, $w); $b = Mockery::mock(BillingClient::class); $b->shouldReceive('serviceLedger')->andReturn(['spent_minor' => 1000, 'credited_minor' => 0]); $b->shouldReceive('balanceMinor')->andReturn(5000); $this->app->instance(BillingClient::class, $b); $this->actingAs($this->user())->get(route('account.billing')) ->assertOk()->assertSee('Spent on hosting'); } public function test_switch_account_rejects_inaccessible(): void { $this->actingAs($this->user())->post(route('account.switch'), ['account' => 999999])->assertForbidden(); } }