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:
parent
33943a907b
commit
449e6f8e03
22 changed files with 909 additions and 7 deletions
28
devel/tests/helpers/find_pdf_file.phpt
Normal file
28
devel/tests/helpers/find_pdf_file.phpt
Normal file
|
|
@ -0,0 +1,28 @@
|
|||
--TEST--
|
||||
findPdfFile: finds first .pdf file in a directory
|
||||
--FILE--
|
||||
<?php
|
||||
require '/var/www/app/helpers.php';
|
||||
|
||||
$dir = sys_get_temp_dir() . '/phpt_pdf_' . getmypid();
|
||||
mkdir($dir);
|
||||
|
||||
// No PDF
|
||||
echo (findPdfFile($dir) ?? 'null') . "\n";
|
||||
|
||||
// One PDF
|
||||
touch("$dir/document.pdf");
|
||||
echo findPdfFile($dir) . "\n";
|
||||
|
||||
// Non-PDF files are ignored
|
||||
touch("$dir/image.jpg");
|
||||
touch("$dir/notes.txt");
|
||||
echo findPdfFile($dir) . "\n";
|
||||
|
||||
array_map('unlink', glob("$dir/*"));
|
||||
rmdir($dir);
|
||||
?>
|
||||
--EXPECT--
|
||||
null
|
||||
document.pdf
|
||||
document.pdf
|
||||
Loading…
Add table
Add a link
Reference in a new issue