actingAs(User::factory()->superuser()->create()); $initialObLevel = ob_get_level(); Livewire::test(SlackSettingsForm::class) ->assertStatus(200); // The slack-settings-form view opens @section('content') at line 13 // but never closes it in-file. In production, the parent // settings/slack.blade.php's trailing @stop closes the section. // Livewire::test() renders the component in isolation, so the // section's output buffer stays open and PHPUnit flags the test // as risky. Drain any buffers opened during render. while (ob_get_level() > $initialObLevel) { ob_end_clean(); } } public function test_non_superuser_cannot_mount_or_replay() { $this->actingAs(User::factory()->create()); Livewire::test(SlackSettingsForm::class) ->assertStatus(403); } }