api#347: передавать и настраивать UTM part без ссылки в Preland

This commit is contained in:
Panfilov Konstantin committed 2026-10-28 05:04:08 +03:00
1 parent 94619432a3
commit 0d350ed14b
23 files changed
+126 -47

No files matched your search

+2 -2
View File
@@ -29,12 +29,12 @@ $runtimeBefore = hash_file('sha256', $runtimeFile);
$builder = new LinkBuilder($linkStore);
$empty = ['selection'=>null, 'url'=>null, 'saved_at'=>null];
linkCheck($builder->get('first') === $empty, 'first opening has no implicit saved choice or generated URL');
$selection = ['indpic'=>'9','theme'=>'2','degr'=>'3','reg'=>'1','banch'=>'rnd','tp'=>'4','cons'=>'5','focus'=>'rnd'];
$selection = ['indpic'=>'9','theme'=>'2','degr'=>'3','reg'=>'1','banch'=>'rnd','tp'=>'4','cons'=>'5','focus'=>'rnd','part'=>'rnd'];
$saved = $builder->save('first', $selection);
linkCheck($saved['selection'] === $selection && is_string($saved['saved_at']), 'explicit save returns complete independent selection and timestamp');
linkCheck(str_starts_with($saved['url'], 'https://first.example/?'), 'URL uses saved target HTTPS origin');
parse_str(parse_url($saved['url'], PHP_URL_QUERY), $parameters);
linkCheck(array_keys($parameters) === array_keys($selection), 'URL contains all eight canonical UTM keys');
linkCheck(array_keys($parameters) === array_keys($selection), 'URL contains all nine canonical UTM keys');
foreach ($selection as $key=>$value) {
$digit = $value === 'rnd' ? '0' : $value;
linkCheck((bool)preg_match('/^[a-zA-Z0-9]{4}' . $digit . '[a-zA-Z0-9]+$/D', $parameters[$key]), "{$key} has four ASCII prefix characters, selected digit and noise suffix");