assert($hasSessionStart, "$page содержит session_start()"); } else { $test->assert(false, "$page - файл не найден"); } } echo "\nПроверка header_common.php:\n"; $headerCommonPath = __DIR__ . '/../header_common.php'; $test->assert(file_exists($headerCommonPath), "Файл header_common.php существует"); $headerContent = file_get_contents($headerCommonPath); $test->assertContains( "session_status() == PHP_SESSION_NONE", $headerContent, "header_common.php проверяет статус сессии перед стартом" ); $test->assertContains( "\$isAdmin", $headerContent, "header_common.php использует переменную isAdmin" ); $test->assertContains( "Админ", $headerContent, "header_common.php отображает статус 'Админ'" ); $test->assertContains( "Пользователь", $headerContent, "header_common.php отображает статус 'Пользователь'" ); echo "\nПроверка login_handler.php:\n"; $loginHandlerPath = __DIR__ . '/../login_handler.php'; $test->assert(file_exists($loginHandlerPath), "Файл login_handler.php существует"); $loginHandlerContent = file_get_contents($loginHandlerPath); $test->assertContains( "\$_SESSION['isAdmin']", $loginHandlerContent, "login_handler.php сохраняет isAdmin в сессию" ); $test->assertContains( "\$_SESSION['isLoggedIn']", $loginHandlerContent, "login_handler.php сохраняет isLoggedIn в сессию" ); $test->assertContains( "password_verify", $loginHandlerContent, "login_handler.php использует password_verify для проверки пароля" );