setTestValue('backend/frontName', 'custom'); $detector = new AdminPathDetector($config); self::assertSame('custom', $detector->getConfiguredAdminFrontName()); } public function testGetConfiguredAdminFrontNameDefaultsToAdmin(): void { $config = new DeploymentConfig(); $detector = new AdminPathDetector($config); self::assertSame('admin', $detector->getConfiguredAdminFrontName()); } public function testIsAdminPathTrueWhenPathInfoContainsFrontName(): void { $config = new DeploymentConfig(); $config->setTestValue('backend/frontName', 'admin'); $detector = new AdminPathDetector($config); $request = new Http(); $request->setPathInfo('/admin/sales/order'); self::assertTrue($detector->isAdminPath($request)); } public function testIsAdminPathSkipsIndexPhpAndPubSegments(): void { $config = new DeploymentConfig(); $config->setTestValue('backend/frontName', 'admin'); $detector = new AdminPathDetector($config); $request = new Http(); $request->setPathInfo('/pub/index.php/admin/dashboard'); self::assertTrue($detector->isAdminPath($request)); } public function testIsAdminPathFalseForFrontendPath(): void { $config = new DeploymentConfig(); $config->setTestValue('backend/frontName', 'admin'); $detector = new AdminPathDetector($config); $request = new Http(); $request->setPathInfo('/catalog/product/view'); self::assertFalse($detector->isAdminPath($request)); } public function testGetAdminFrontNameIfPresentInPathUsesRequestUriWhenPathInfoEmpty(): void { $config = new DeploymentConfig(); $config->setTestValue('backend/frontName', 'backend'); $detector = new AdminPathDetector($config); $request = new Http(); $request->setPathInfo(''); $request->setRequestUri('/backend/index/index'); self::assertSame('backend', $detector->getAdminFrontNameIfPresentInPath($request)); } }