Files
web_work/tests/RegistrationFormTest.php
2026-01-03 18:59:56 +03:00

78 lines
2.8 KiB
PHP
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
<?php
echo "Проверка расположения надписи на странице регистрации:\n";
$profilePath = __DIR__ . '/../профиль.php';
$test->assert(file_exists($profilePath), "Файл профиль.php существует");
$profileContent = file_get_contents($profilePath);
$hasNoticeInFormBlock = preg_match('/profile-form-block[^}]*form-notice[^}]*РЕГИСТРАЦИЯ/s', $profileContent) === 1;
$test->assert($hasNoticeInFormBlock, "Надпись находится внутри profile-form-block (профиль.php)");
$noticeBeforeTitle = preg_match('/info-circle.*Для доступа.*РЕГИСТРАЦИЯ/s', $profileContent) === 1;
$test->assert($noticeBeforeTitle, "Надпись находится перед заголовком РЕГИСТРАЦИЯ (профиль.php)");
echo "\nПроверка app/Views/auth/register.php:\n";
$registerViewPath = __DIR__ . '/../app/Views/auth/register.php';
$test->assert(file_exists($registerViewPath), "Файл register.php view существует");
$registerViewContent = file_get_contents($registerViewPath);
$hasNoticeInFormBlockView = preg_match('/profile-form-block[^}]*info-circle.*Для доступа[^}]*РЕГИСТРАЦИЯ/s', $registerViewContent) === 1;
$test->assert($hasNoticeInFormBlockView, "Надпись находится внутри profile-form-block (register.php view)");
$noticeOutsideContainer = preg_match('/<main[^>]*>.*Для доступа к каталогу.*profile-container/s', $registerViewContent) === 1;
$test->assert(!$noticeOutsideContainer, "Надпись 'Для доступа' НЕ находится перед profile-container (register.php view)");
echo "\nПроверка формы регистрации:\n";
$test->assertContains(
'name="fio"',
$profileContent,
"Поле ФИО присутствует в форме"
);
$test->assertContains(
'name="email"',
$profileContent,
"Поле email присутствует в форме"
);
$test->assertContains(
'name="password"',
$profileContent,
"Поле password присутствует в форме"
);
$test->assertContains(
'name="confirm-password"',
$profileContent,
"Поле confirm-password присутствует в форме"
);
$test->assertContains(
'name="city"',
$profileContent,
"Поле city присутствует в форме"
);
$test->assertContains(
'name="phone"',
$profileContent,
"Поле phone присутствует в форме"
);
$test->assertContains(
'name="privacy"',
$profileContent,
"Чекбокс согласия присутствует в форме"
);
$test->assertContains(
'action="register_handler.php"',
$profileContent,
"Форма отправляется на register_handler.php"
);