UPDATED TESTS wirr dusk

This commit is contained in:
Mark Gregory
2026-06-11 14:51:28 +01:00
parent cad45a870d
commit a55b98cf38
13 changed files with 300 additions and 359 deletions
+26 -27
View File
@@ -17,7 +17,7 @@ trait InteractsWithWmsData
protected function platformAdminUser(array $overrides = []): User
{
$company = Company::query()->firstOrCreate(
$company = Company::query()->updateOrCreate(
['slug' => 'mpba-limited'],
[
'name' => 'MPBA Limited',
@@ -43,6 +43,26 @@ trait InteractsWithWmsData
);
}
protected function tenantCompany(array $overrides = []): Company
{
$company = Company::query()->updateOrCreate(
['slug' => $overrides['slug'] ?? 'test-company'],
[
'name' => $overrides['name'] ?? 'Test Company',
'status' => $overrides['status'] ?? 'active',
'timezone' => 'Europe/London',
'is_system_company' => false,
'billing_email' => $overrides['billing_email'] ?? 'billing@test-company.example',
...$overrides,
],
);
LicenseKey::query()->where('company_id', $company->id)->delete();
LicenseKey::issueFor($company, 'Browser Test Licence', 'enterprise', 250);
return $company->refresh();
}
protected function tenantUser(array $overrides = []): User
{
$company = $this->tenantCompany();
@@ -62,33 +82,12 @@ trait InteractsWithWmsData
);
}
protected function tenantCompany(array $overrides = []): Company
{
$company = Company::query()->updateOrCreate(
['slug' => $overrides['slug'] ?? 'test-company'],
[
'name' => $overrides['name'] ?? 'Test Company',
'status' => $overrides['status'] ?? 'active',
'timezone' => 'Europe/London',
'is_system_company' => false,
'billing_email' => $overrides['billing_email'] ?? 'billing@test-company.example',
...$overrides,
],
);
if (! $company->hasActiveLicense()) {
LicenseKey::issueFor($company, 'Browser Test Licence', 'enterprise', 250);
}
return $company;
}
protected function seedPlatformPrices(): void
{
foreach ([
['basic', 'Basic', 'Starter WMS access', 'Core warehouse management for small teams.', 4900, 49000, 10, false, true, ['2 warehouses', '10 users', 'Standard support']],
['advanced', 'Advanced', 'Growing WMS operations', 'More users, warehouses and automation controls.', 14900, 149000, 20, true, true, ['5 warehouses', '100 users', 'Advanced support']],
['pro', 'Pro', 'Professional WMS command centre', 'Full operational visibility for larger teams.', 29900, 299000, 30, false, true, ['15 warehouses', 'Unlimited dashboards', 'Priority support']],
['pro', 'Pro', 'Professional WMS command centre', 'Full operational visibility for larger teams.', 29900, 299000, 30, false, true, ['15 warehouses', '1000 users', 'Priority support']],
] as [$code, $name, $strapline, $description, $monthly, $annual, $sortOrder, $featured, $active, $features]) {
PlatformPrice::query()->updateOrCreate(
['code' => $code],
@@ -109,14 +108,14 @@ trait InteractsWithWmsData
}
}
protected function seedWarehouse(?Company $company = null): Warehouse
protected function seedWarehouse(?Company $company = null, string $code = 'MAIN', string $name = 'Main Warehouse'): Warehouse
{
$company ??= $this->tenantCompany();
$warehouse = Warehouse::query()->updateOrCreate(
['company_id' => $company->id, 'code' => 'MAIN'],
['company_id' => $company->id, 'code' => $code],
[
'name' => 'Main Warehouse',
'name' => $name,
'address' => 'Main Road, Nottingham',
'status' => 'active',
'timezone' => 'Europe/London',
@@ -133,7 +132,7 @@ trait InteractsWithWmsData
],
);
return $warehouse;
return $warehouse->refresh();
}
protected function seedPlatformDashboardData(): void