fix(config): enable explicit face focus
This commit is contained in:
1 parent
f14ce88cc6
commit
ac4cc21361
5 files changed
+64
-18
No files matched your search
@@ -0,0 +1,39 @@
|
||||
<?php
|
||||
/** Регрессия правила: deploy меняет только явно согласованный ключ focus. */
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
$root = dirname(__DIR__);
|
||||
$script = $root . '/bin/ensure-focus-config.php';
|
||||
$fixture = [
|
||||
'host' => 'custom.example',
|
||||
'requisites' => ['Не менять'],
|
||||
'utm' => [
|
||||
'theme' => ['weights' => ['dark' => 7, 'light' => 3], 'default' => 'light'],
|
||||
'focus' => ['weights' => ['center' => 9, 'face' => 1], 'default' => 'center'],
|
||||
],
|
||||
];
|
||||
$path = tempnam(sys_get_temp_dir(), 'preland-config-');
|
||||
if ($path === false) {
|
||||
fwrite(STDERR, "FAIL: не создан временный config.\n");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
try {
|
||||
file_put_contents($path, json_encode($fixture, JSON_THROW_ON_ERROR));
|
||||
exec(PHP_BINARY . ' ' . escapeshellarg($script) . ' ' . escapeshellarg($path), $output, $code);
|
||||
$actual = json_decode((string) file_get_contents($path), true, 512, JSON_THROW_ON_ERROR);
|
||||
} finally {
|
||||
@unlink($path);
|
||||
}
|
||||
|
||||
if ($code !== 10
|
||||
|| ($actual['host'] ?? null) !== 'custom.example'
|
||||
|| ($actual['requisites'] ?? null) !== ['Не менять']
|
||||
|| ($actual['utm']['theme'] ?? null) !== $fixture['utm']['theme']
|
||||
|| ($actual['utm']['focus'] ?? null) !== ['weights' => ['center' => 0, 'face' => 1], 'default' => 'face']) {
|
||||
fwrite(STDERR, "FAIL: host-config должен сохранить все значения, кроме явно заданного focus.\n");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
fwrite(STDOUT, "OK: host config changes only explicit focus\n");
|
||||
Reference in new issue
Block a user