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,44 @@
--TEST--
loadMetadata: parses metadata.ini, returns null when absent
--FILE--
<?php
require '/var/www/app/hooks.php';
require '/var/www/app/content.php';
$dir = sys_get_temp_dir() . '/phpt_meta_' . getmypid();
mkdir($dir);
// No metadata file
echo (loadMetadata($dir) ?? 'null') . "\n";
// Basic key-value metadata
file_put_contents("$dir/metadata.ini", "title = My Page\nsummary = A summary\nmenu = true\n");
$meta = loadMetadata($dir);
echo $meta['title'] . "\n";
echo $meta['summary'] . "\n";
echo $meta['menu'] . "\n";
// _raw is always present
echo isset($meta['_raw']) ? 'raw present' : 'raw missing';
echo "\n";
// Sections are in _raw but not in base metadata
file_put_contents("$dir/metadata.ini", "[en]\ntitle = English Title\n\n[fr]\ntitle = French Title\n");
$meta = loadMetadata($dir);
echo isset($meta['en']) ? 'section leaked' : 'section contained';
echo "\n";
echo $meta['_raw']['en']['title'] . "\n";
echo $meta['_raw']['fr']['title'] . "\n";
array_map('unlink', glob("$dir/*"));
rmdir($dir);
?>
--EXPECT--
null
My Page
A summary
1
raw present
section contained
English Title
French Title