diff --git a/config.json b/config.json index b63fcbd..8b4049a 100644 --- a/config.json +++ b/config.json @@ -56,7 +56,7 @@ "1": 0, "2": 1 }, - "default": "1" + "default": "2" }, "focus": { "weights": { diff --git a/tests/check-utm-redirect-contract.php b/tests/check-utm-redirect-contract.php index 2067501..a136f83 100644 --- a/tests/check-utm-redirect-contract.php +++ b/tests/check-utm-redirect-contract.php @@ -30,6 +30,7 @@ if (!is_string($query)) { } parse_str($query, $params); +$config = json_decode((string) file_get_contents(dirname(__DIR__) . '/config.json'), true); $expected = [ 'indpic' => '1', 'theme' => 'dark', @@ -37,7 +38,7 @@ $expected = [ 'registration' => 'after', 'bchoice' => 'a', 'chb' => 'b', - 'tp' => '1', + 'tp' => $config['utm']['tp']['default'] ?? null, 'focus' => 'face', 'utm_source' => 'stage-ad', 'subid' => 'click-42', diff --git a/tests/check-versioned-stage-config.php b/tests/check-versioned-stage-config.php index e0b64f5..20badda 100644 --- a/tests/check-versioned-stage-config.php +++ b/tests/check-versioned-stage-config.php @@ -17,27 +17,20 @@ $config = is_file($configPath) ? json_decode((string) file_get_contents($configP if (!is_array($config)) { $failures[] = 'Рабочий config.json должен существовать в корне приленда и содержать валидный JSON.'; } else { - $expected = [ - 'host' => 'zoomzilla.ru', - 'indpic' => ['1' => 1, '2' => 0, 'default' => '1'], - 'theme' => ['light' => 0, 'dark' => 1, 'default' => 'dark'], - 'degr' => ['1' => 1, '2' => 0, 'default' => '1'], - 'registration' => ['before' => 0, 'after' => 1, 'default' => 'after'], - 'bchoice' => ['a' => 1, 'b' => 0, 'default' => 'a'], - 'chb' => ['a' => 1, 'b' => 0, 'default' => 'b'], - 'tp' => ['1' => 0, '2' => 1, 'default' => '1'], - 'focus' => ['center' => 0, 'face' => 1, 'default' => 'face'], - ]; - - if (($config['host'] ?? null) !== $expected['host']) { + if (($config['host'] ?? null) !== 'zoomzilla.ru') { $failures[] = 'Рабочий config.json обязан направлять загрузку на zoomzilla.ru.'; } - foreach (array_diff_key($expected, ['host' => true]) as $key => $settings) { - $actual = $config['utm'][$key] ?? []; - if (($actual['weights'] ?? null) !== array_diff_key($settings, ['default' => true]) - || ($actual['default'] ?? null) !== $settings['default']) { - $failures[] = "Рабочий config.json должен сохранять stage-настройку UTM {$key}."; + $focus = $config['utm']['focus'] ?? null; + if (($focus['weights'] ?? null) !== ['center' => 0, 'face' => 1] + || ($focus['default'] ?? null) !== 'face') { + $failures[] = 'Рабочий config.json должен фиксировать явно согласованный focus=face.'; + } + + foreach (['indpic', 'theme', 'degr', 'registration', 'bchoice', 'chb', 'tp'] as $key) { + $setting = $config['utm'][$key] ?? null; + if (!is_array($setting) || !is_array($setting['weights'] ?? null) || !is_string($setting['default'] ?? null)) { + $failures[] = "Рабочий config.json должен хранить валидный stage-снимок UTM {$key}."; } } }