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,33 @@
--TEST--
findCoverImage: finds cover.{ext} in directory, prefers first matching extension
--FILE--
<?php
require '/var/www/app/constants.php';
require '/var/www/app/helpers.php';
$dir = sys_get_temp_dir() . '/phpt_cover_' . getmypid();
mkdir($dir);
// No cover image
echo (findCoverImage($dir) ?? 'null') . "\n";
// cover.jpg
touch("$dir/cover.jpg");
echo findCoverImage($dir) . "\n";
// cover.webp added — jpg should still win (it's first in COVER_IMAGE_EXTENSIONS)
touch("$dir/cover.webp");
echo findCoverImage($dir) . "\n";
// Remove jpg — webp should now be found
unlink("$dir/cover.jpg");
echo findCoverImage($dir) . "\n";
array_map('unlink', glob("$dir/*"));
rmdir($dir);
?>
--EXPECT--
null
cover.jpg
cover.jpg
cover.webp