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
39
devel/tests/helpers/get_subdirectories.phpt
Normal file
39
devel/tests/helpers/get_subdirectories.phpt
Normal file
|
|
@ -0,0 +1,39 @@
|
|||
--TEST--
|
||||
getSubdirectories: returns only subdirectory names, ignores files
|
||||
--FILE--
|
||||
<?php
|
||||
require '/var/www/app/helpers.php';
|
||||
|
||||
$dir = sys_get_temp_dir() . '/phpt_subdirs_' . getmypid();
|
||||
mkdir($dir);
|
||||
|
||||
// Empty directory
|
||||
$result = getSubdirectories($dir);
|
||||
echo (empty($result) ? 'empty' : 'not empty') . "\n";
|
||||
|
||||
// Non-existent directory
|
||||
echo count(getSubdirectories($dir . '/nope')) . "\n";
|
||||
|
||||
// Add subdirectories and a file
|
||||
mkdir("$dir/alpha");
|
||||
mkdir("$dir/beta");
|
||||
touch("$dir/file.txt");
|
||||
|
||||
$result = array_values(getSubdirectories($dir));
|
||||
sort($result);
|
||||
echo implode("\n", $result) . "\n";
|
||||
|
||||
// Files are not included
|
||||
echo in_array('file.txt', $result) ? "file included\n" : "file excluded\n";
|
||||
|
||||
unlink("$dir/file.txt");
|
||||
rmdir("$dir/alpha");
|
||||
rmdir("$dir/beta");
|
||||
rmdir($dir);
|
||||
?>
|
||||
--EXPECT--
|
||||
empty
|
||||
0
|
||||
alpha
|
||||
beta
|
||||
file excluded
|
||||
Loading…
Add table
Add a link
Reference in a new issue