- Add comprehensive health check system with multiple endpoints - Add Prometheus metrics endpoint - Add production logging configurations (5 strategies) - Add complete deployment documentation suite: * QUICKSTART.md - 30-minute deployment guide * DEPLOYMENT_CHECKLIST.md - Printable verification checklist * DEPLOYMENT_WORKFLOW.md - Complete deployment lifecycle * PRODUCTION_DEPLOYMENT.md - Comprehensive technical reference * production-logging.md - Logging configuration guide * ANSIBLE_DEPLOYMENT.md - Infrastructure as Code automation * README.md - Navigation hub * DEPLOYMENT_SUMMARY.md - Executive summary - Add deployment scripts and automation - Add DEPLOYMENT_PLAN.md - Concrete plan for immediate deployment - Update README with production-ready features All production infrastructure is now complete and ready for deployment.
119 lines
4.1 KiB
PHP
119 lines
4.1 KiB
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
namespace Tests\Application\Admin\ValueObjects;
|
|
|
|
use App\Application\Admin\ValueObjects\AdminLayoutData;
|
|
use App\Application\Admin\ValueObjects\Breadcrumb;
|
|
use App\Application\Admin\ValueObjects\BreadcrumbCollection;
|
|
use App\Application\Admin\ValueObjects\NavigationItem;
|
|
use App\Application\Admin\ValueObjects\NavigationMenu;
|
|
use App\Application\Admin\ValueObjects\NavigationSection;
|
|
|
|
describe('AdminLayoutData Value Object', function () {
|
|
it('can be created with all required parameters', function () {
|
|
$navigationMenu = new NavigationMenu([]);
|
|
$breadcrumbs = new BreadcrumbCollection([]);
|
|
|
|
$layoutData = new AdminLayoutData(
|
|
title: 'Test Page',
|
|
navigationMenu: $navigationMenu,
|
|
breadcrumbs: $breadcrumbs,
|
|
currentPath: '/admin/test'
|
|
);
|
|
|
|
expect($layoutData->title)->toBe('Test Page');
|
|
expect($layoutData->currentPath)->toBe('/admin/test');
|
|
expect($layoutData->navigationMenu)->toBe($navigationMenu);
|
|
expect($layoutData->breadcrumbs)->toBe($breadcrumbs);
|
|
});
|
|
|
|
it('can be created from array', function () {
|
|
$data = [
|
|
'title' => 'Dashboard',
|
|
'current_path' => '/admin/dashboard',
|
|
'navigation_menu' => [
|
|
[
|
|
'section' => 'System',
|
|
'items' => [
|
|
['name' => 'Dashboard', 'url' => '/admin'],
|
|
['name' => 'Users', 'url' => '/admin/users'],
|
|
],
|
|
],
|
|
],
|
|
'breadcrumbs_data' => [
|
|
['name' => 'Admin', 'url' => '/admin'],
|
|
['name' => 'Dashboard', 'url' => '/admin/dashboard'],
|
|
],
|
|
];
|
|
|
|
$layoutData = AdminLayoutData::fromArray($data);
|
|
|
|
expect($layoutData->title)->toBe('Dashboard');
|
|
expect($layoutData->currentPath)->toBe('/admin/dashboard');
|
|
expect($layoutData->navigationMenu->sections)->toHaveCount(1);
|
|
expect($layoutData->breadcrumbs->breadcrumbs)->toHaveCount(2);
|
|
});
|
|
|
|
it('converts to array correctly', function () {
|
|
$navigationMenu = new NavigationMenu([
|
|
new NavigationSection('System', [
|
|
new NavigationItem('Dashboard', '/admin'),
|
|
]),
|
|
]);
|
|
|
|
$breadcrumbs = new BreadcrumbCollection([
|
|
new Breadcrumb('Admin', '/admin'),
|
|
]);
|
|
|
|
$layoutData = new AdminLayoutData(
|
|
title: 'Test Page',
|
|
navigationMenu: $navigationMenu,
|
|
breadcrumbs: $breadcrumbs,
|
|
currentPath: '/admin/test'
|
|
);
|
|
|
|
$array = $layoutData->toArray();
|
|
|
|
expect($array['title'])->toBe('Test Page');
|
|
expect($array['page_title'])->toBe('Test Page');
|
|
expect($array['current_path'])->toBe('/admin/test');
|
|
expect($array['navigation_menu'])->toBeArray();
|
|
expect($array['breadcrumbs_data'])->toBeArray();
|
|
});
|
|
|
|
it('supports immutable transformations', function () {
|
|
$originalData = new AdminLayoutData(
|
|
title: 'Original',
|
|
navigationMenu: new NavigationMenu([]),
|
|
breadcrumbs: new BreadcrumbCollection([]),
|
|
currentPath: '/admin'
|
|
);
|
|
|
|
$newData = $originalData->withTitle('New Title');
|
|
|
|
expect($originalData->title)->toBe('Original');
|
|
expect($newData->title)->toBe('New Title');
|
|
expect($newData !== $originalData)->toBeTrue();
|
|
});
|
|
|
|
it('handles optional parameters correctly', function () {
|
|
$layoutData = new AdminLayoutData(
|
|
title: 'Test',
|
|
navigationMenu: new NavigationMenu([]),
|
|
breadcrumbs: new BreadcrumbCollection([]),
|
|
currentPath: '/admin',
|
|
metaDescription: 'Test description',
|
|
pageClass: 'admin-page'
|
|
);
|
|
|
|
expect($layoutData->metaDescription)->toBe('Test description');
|
|
expect($layoutData->pageClass)->toBe('admin-page');
|
|
|
|
$array = $layoutData->toArray();
|
|
expect($array['meta_description'])->toBe('Test description');
|
|
expect($array['page_class'])->toBe('admin-page');
|
|
});
|
|
});
|