38 lines
1.4 KiB
PHP
38 lines
1.4 KiB
PHP
<?php
|
|
|
|
require __DIR__.'/bootstrap.php';
|
|
|
|
function test_fail($message)
|
|
{
|
|
fwrite(STDERR, "FAIL: {$message}\n");
|
|
exit(1);
|
|
}
|
|
|
|
function test_assert($condition, $message)
|
|
{
|
|
if(!$condition) test_fail($message);
|
|
echo "ok - {$message}\n";
|
|
}
|
|
|
|
test_assert(component_exists('callable-fixture'), 'component lookup finds caller-relative components');
|
|
test_assert(component_exists('multi-fixture'), 'component lookup finds components with named render methods');
|
|
|
|
$callable = component('callable-fixture');
|
|
test_assert(str_contains($callable, 'callable fixture'), 'component renders its default callable');
|
|
|
|
$custom = component_call('multi-fixture', 'custom');
|
|
test_assert(str_contains($custom, 'custom fixture'), 'component_call renders a named method');
|
|
|
|
test_assert(safe('<script>') === '<script>', 'safe escapes HTML text');
|
|
test_assert(asafe('" onload="x') === '" onload="x', 'asafe escapes HTML attributes');
|
|
|
|
$head = component_call('theme/shell', 'head', [
|
|
'extra_css' => ['themes/exoplasim/css/style.css'],
|
|
'extra_js' => ['js/workbench.js'],
|
|
]);
|
|
test_assert(str_contains($head, 'themes/exoplasim/css/style.css'), 'theme shell includes the application stylesheet');
|
|
test_assert(str_contains($head, 'js/workbench.js'), 'theme shell includes the workbench script');
|
|
test_assert(!str_contains($head, 'favicon') && !str_contains($head, 'icon.png'), 'theme shell does not reference removed starter icons');
|
|
|
|
echo "All smoke tests passed.\n";
|