feat(superadmin): migrate internal docs from docusaurus to guava kb
This commit is contained in:
@@ -96,7 +96,26 @@ class FilamentPanelNavigationTest extends TestCase
|
||||
$pages = $resource::getPages();
|
||||
$this->assertNotEmpty($pages, $resource);
|
||||
|
||||
$registration = $pages['index'] ?? reset($pages);
|
||||
$registration = $pages['index'] ?? null;
|
||||
|
||||
if (! $registration) {
|
||||
foreach ($pages as $pageRegistration) {
|
||||
$candidate = $pageRegistration instanceof PageRegistration ? $pageRegistration->getPage() : $pageRegistration;
|
||||
|
||||
if ($this->pageRequiresMountArguments($candidate)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$registration = $pageRegistration;
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (! $registration) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$pageClass = $registration instanceof PageRegistration ? $registration->getPage() : $registration;
|
||||
|
||||
Livewire::test($pageClass)
|
||||
@@ -107,4 +126,23 @@ class FilamentPanelNavigationTest extends TestCase
|
||||
Filament::setTenant(null, true);
|
||||
}
|
||||
}
|
||||
|
||||
private function pageRequiresMountArguments(string $pageClass): bool
|
||||
{
|
||||
if (! method_exists($pageClass, 'mount')) {
|
||||
return false;
|
||||
}
|
||||
|
||||
$reflection = new \ReflectionMethod($pageClass, 'mount');
|
||||
|
||||
foreach ($reflection->getParameters() as $parameter) {
|
||||
if ($parameter->isOptional() || $parameter->isDefaultValueAvailable() || $parameter->allowsNull()) {
|
||||
continue;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user