Update framework testing infrastructure and standards

- Add phpt test runner and suite for app functions
- Introduce testing workflow to AGENT.md
- Add tests for cache, content, context, helpers, hooks, plugins,
  rendering
- Mount tests directory in dev container
This commit is contained in:
Ruben 2026-03-17 12:51:07 +01:00
parent 33943a907b
commit 449e6f8e03
22 changed files with 909 additions and 7 deletions

View file

@ -0,0 +1,39 @@
--TEST--
renderContentFile: renders .html by inclusion and .md via Parsedown
--FILE--
<?php
require '/var/www/app/context.php';
require '/var/www/app/hooks.php';
require '/var/www/app/rendering.php';
$dir = sys_get_temp_dir() . '/phpt_render_' . getmypid();
mkdir($dir);
// HTML file — returned as-is (direct inclusion)
$htmlFile = "$dir/page.html";
file_put_contents($htmlFile, '<p>Hello <strong>world</strong></p>');
echo trim(renderContentFile($htmlFile)) . "\n";
// Markdown — converted to HTML by Parsedown
$mdFile = "$dir/post.md";
file_put_contents($mdFile, "# My Title\n\nA paragraph.");
$html = renderContentFile($mdFile);
echo (str_contains($html, '<h1>My Title</h1>') ? 'h1 ok' : 'h1 missing') . "\n";
echo (str_contains($html, '<p>A paragraph.</p>') ? 'p ok' : 'p missing') . "\n";
// Unknown extension — returns empty string
$txtFile = "$dir/notes.txt";
file_put_contents($txtFile, 'raw text');
echo (renderContentFile($txtFile) === '') ? 'empty ok' : 'not empty';
echo "\n";
unlink($htmlFile);
unlink($mdFile);
unlink($txtFile);
rmdir($dir);
?>
--EXPECT--
<p>Hello <strong>world</strong></p>
h1 ok
p ok
empty ok