35 lines
1.6 KiB
PHP
35 lines
1.6 KiB
PHP
<?php
|
|
function assertTrue($cond, $msg) {
|
|
if (!$cond) {
|
|
fwrite(STDERR, $msg . PHP_EOL);
|
|
exit(1);
|
|
}
|
|
}
|
|
|
|
$envPath = __DIR__ . '/../.env';
|
|
assertTrue(file_exists($envPath), 'missing .env');
|
|
$envContent = file_get_contents($envPath);
|
|
assertTrue(strpos($envContent, 'RECAPTCHA_SITE_KEY') !== false, 'missing site key');
|
|
assertTrue(strpos($envContent, 'RECAPTCHA_SECRET_KEY') !== false, 'missing secret key');
|
|
|
|
$configPath = __DIR__ . '/../includes/config.php';
|
|
assertTrue(file_exists($configPath), 'missing config.php');
|
|
$configContent = file_get_contents($configPath);
|
|
assertTrue(strpos($configContent, 'RECAPTCHA_SITE_KEY') !== false, 'config missing site key');
|
|
assertTrue(strpos($configContent, 'RECAPTCHA_SECRET_KEY') !== false, 'config missing secret key');
|
|
|
|
$indexContent = file_get_contents(__DIR__ . '/../index.php');
|
|
assertTrue(strpos($indexContent, 'includes/config.php') !== false, 'index missing config require');
|
|
|
|
$footerContent = file_get_contents(__DIR__ . '/../templates/footer.php');
|
|
assertTrue(strpos($footerContent, 'recaptcha/api.js') !== false, 'missing recaptcha script');
|
|
assertTrue(strpos($footerContent, 'RECAPTCHA_SITE_KEY') !== false, 'missing site key exposure');
|
|
|
|
$contactJs = file_get_contents(__DIR__ . '/../assets/js/contact-form.js');
|
|
assertTrue(strpos($contactJs, 'RecaptchaService') !== false, 'missing RecaptchaService');
|
|
assertTrue(strpos($contactJs, 'getToken') !== false, 'missing getToken');
|
|
assertTrue(strpos($contactJs, 'grecaptcha.execute') !== false, 'missing grecaptcha execute');
|
|
assertTrue(strpos($contactJs, 'console.warn') !== false, 'missing graceful warning');
|
|
|
|
fwrite(STDOUT, "OK\n");
|