You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
76 lines
3.2 KiB
PHP
76 lines
3.2 KiB
PHP
<?php
|
|
|
|
$root = dirname(__DIR__, 2);
|
|
$read = static function (string $path) use ($root): string {
|
|
$content = file_get_contents($root . '/' . $path);
|
|
if ($content === false) {
|
|
throw new RuntimeException('Cannot read ' . $path);
|
|
}
|
|
return $content;
|
|
};
|
|
$assert = static function (bool $condition, string $message): void {
|
|
if (!$condition) {
|
|
throw new RuntimeException($message);
|
|
}
|
|
};
|
|
|
|
$partialPath = 'web/resources/views/venix/components/site_brand_mark.tpl';
|
|
$partial = $read($partialPath);
|
|
$style = $read('web/public/theme/venix/css/site-brand.css');
|
|
$assert(str_contains($partial, 'class="site-brand-mark"')
|
|
&& substr_count($partial, '<i></i>') === 2,
|
|
'The shared site-brand partial is not the approved two-square mark.');
|
|
$assert(str_contains($style, 'transform: rotate(45deg)')
|
|
&& str_contains($style, 'border: 6px solid currentColor')
|
|
&& str_contains($style, 'color: #2de2c2'),
|
|
'The shared site-brand style drifted from the landing-page mark.');
|
|
|
|
$layouts = [
|
|
'web/resources/views/venix/home/layout_header.tpl',
|
|
'web/resources/views/venix/auth/layout_header.tpl',
|
|
'web/resources/views/venix/user/layout_header.tpl',
|
|
'web/resources/views/venix/user/layout_plain_header.tpl',
|
|
'web/resources/views/venix/cloud/page.tpl',
|
|
'web/resources/views/venix/admin/static_header.tpl',
|
|
];
|
|
foreach ($layouts as $layout) {
|
|
$assert(str_contains($read($layout), '/theme/venix/css/site-brand.css?v='),
|
|
$layout . ' does not load the canonical site-brand stylesheet.');
|
|
}
|
|
|
|
$presenters = [
|
|
'web/resources/views/venix/home/site_header.tpl' => 1,
|
|
'web/resources/views/venix/home/site_footer.tpl' => 1,
|
|
'web/resources/views/venix/user/panel_sidebar.tpl' => 1,
|
|
'web/resources/views/venix/user/disable.tpl' => 1,
|
|
'web/resources/views/venix/admin/static_header.tpl' => 4,
|
|
];
|
|
foreach ($presenters as $template => $expectedIncludes) {
|
|
$assert(substr_count($read($template), "include file='components/site_brand_mark.tpl'") === $expectedIncludes,
|
|
$template . ' does not render the canonical site-brand mark.');
|
|
}
|
|
$assert(str_contains($read('web/resources/views/venix/auth/layout_header.tpl'), "include file='home/site_header.tpl'"),
|
|
'The authentication layout does not reuse the canonical public site header.');
|
|
|
|
$templates = new RecursiveIteratorIterator(new RecursiveDirectoryIterator(
|
|
$root . '/web/resources/views/venix',
|
|
FilesystemIterator::SKIP_DOTS
|
|
));
|
|
foreach ($templates as $template) {
|
|
if (!$template->isFile() || $template->getExtension() !== 'tpl') {
|
|
continue;
|
|
}
|
|
$content = file_get_contents($template->getPathname());
|
|
$assert($content !== false, 'Cannot read ' . $template->getPathname());
|
|
$assert(!str_contains($content, 'class="brand-mark"')
|
|
&& !str_contains($content, 'landing-brand-mark')
|
|
&& !preg_match('/logo-(?:sm|light|dark)\.png/', $content),
|
|
'A legacy visible site logo remains in ' . $template->getPathname());
|
|
}
|
|
|
|
$assets = $read('web/resources/views/venix/layout_assets.tpl');
|
|
$assert(str_contains($assets, "value='2026102505'"),
|
|
'The shared asset version was not updated for the canonical logo.');
|
|
|
|
echo "Shared site-brand contract passed across public, auth, user, cloud and admin layouts.\n";
|