Files
WMS/tests/Feature/Modules/ModulePlaceholderPageTest.php
T
2026-06-10 14:56:43 +01:00

66 lines
3.2 KiB
PHP

<?php
namespace Tests\Feature\Modules;
use App\Models\User;
use Illuminate\Foundation\Testing\RefreshDatabase;
use Tests\TestCase;
class ModulePlaceholderPageTest extends TestCase
{
use RefreshDatabase;
/**
* @return array<string, array{route:string, heading:string, expected:array<int,string>}>
*/
public static function modulePages(): array
{
return [
'analytics' => ['route' => 'analytics.index', 'heading' => 'Analytics', 'expected' => ['KPI1 Bar', 'OTTC', 'Warehouse Performance']],
'audit' => ['route' => 'audit.index', 'heading' => 'Audit', 'expected' => ['Audit Trail', 'User Activity', 'Stock Adjustments']],
'carrier-management' => ['route' => 'carrier-management.index', 'heading' => 'Carrier Management', 'expected' => ['Carrier Master', 'Service Levels']],
'configuration' => ['route' => 'configuration.index', 'heading' => 'Configuration', 'expected' => ['System Parameters', 'Reference Data']],
'document-archive' => ['route' => 'document-archive.index', 'heading' => 'Document Archive', 'expected' => ['POD Archive', 'Document Lookup']],
'inventory-management' => ['route' => 'inventory-management.index', 'heading' => 'Inventory Management', 'expected' => ['Stock Enquiry', 'Stock Adjustments']],
'm3-integration' => ['route' => 'm3-integration.index', 'heading' => 'M3 Integration', 'expected' => ['Inbound Interfaces', 'Outbound Interfaces']],
'replenishment' => ['route' => 'replenishment.index', 'heading' => 'Replenishment', 'expected' => ['Shortage Monitor', 'Replenishment Tasks']],
'reporting' => ['route' => 'reporting.index', 'heading' => 'Reporting', 'expected' => ['Operational Reports', 'Export Packs']],
'security' => ['route' => 'security.index', 'heading' => 'Security', 'expected' => ['Users', 'Roles', 'Permissions']],
'sentinel-integration' => ['route' => 'sentinel-integration.index', 'heading' => 'Sentinel Integration', 'expected' => ['Sentinel Sync', 'Message Queue']],
'shipping' => ['route' => 'shipping.index', 'heading' => 'Shipping', 'expected' => ['Open Shipments', 'Dispatch Exceptions']],
'transportation' => ['route' => 'transportation.index', 'heading' => 'Transportation', 'expected' => ['Pending Truck Closure', 'Freight Terms']],
];
}
/**
* @dataProvider modulePages
*
* @param array<int,string> $expected
*/
public function test_module_placeholder_page_renders(string $route, string $heading, array $expected): void
{
$user = User::factory()->create();
$response = $this->actingAs($user)->get(route($route));
$response->assertOk();
$response->assertSee($heading);
$response->assertSee('Replacement module');
$response->assertSee('workbench');
foreach ($expected as $text) {
$response->assertSee($text);
}
}
/**
* @dataProvider modulePages
*
* @param array<int,string> $expected
*/
public function test_module_placeholder_page_requires_authentication(string $route, string $heading, array $expected): void
{
$this->get(route($route))->assertRedirect(route('login'));
}
}