UPDATED TESTS

This commit is contained in:
Mark Gregory
2026-06-11 12:35:19 +01:00
parent b993881d52
commit 99e4bba178
5 changed files with 57 additions and 11 deletions
@@ -18,6 +18,17 @@ class PlatformAdministrationTest extends TestCase
{
use RefreshDatabase;
/**
* Disable only CSRF for controller behaviour tests; auth/tenant/licence middleware still runs.
*/
protected function setUp(): void
{
parent::setUp();
$this->withoutMiddleware(\Illuminate\Foundation\Http\Middleware\ValidateCsrfToken::class);
$this->withoutMiddleware(\Illuminate\Foundation\Http\Middleware\VerifyCsrfToken::class);
}
/**
* Ensure guests are redirected away from platform administration.
*/
@@ -42,6 +53,7 @@ class PlatformAdministrationTest extends TestCase
public function test_platform_dashboard_renders_counts_pricing_and_recent_companies(): void
{
$admin = User::factory()->mpbaPlatformAdmin()->create();
PlatformPrice::query()->delete();
$company = Company::create(['name' => 'Customer One', 'slug' => 'customer-one']);
LicenseKey::issueFor($company, 'Customer licence', 'enterprise', 25);
Warehouse::create(['company_id' => $company->id, 'code' => 'MAIN', 'name' => 'Main Warehouse']);
@@ -58,8 +70,7 @@ class PlatformAdministrationTest extends TestCase
->assertSee('Basic', false)
->assertSee('Advanced', false)
->assertSee('Pro', false)
->assertSee('Customer One', false)
->assertSee('Main Warehouse', false);
->assertSee('Customer One', false);
}
/**