Add PHP unit tests and page tests.

Run "composer install", then "composer test".
This commit is contained in:
tim
2026-09-26 03:48:09 +02:00
parent 848c447c5b
commit ed959888b4
42 changed files with 5522 additions and 0 deletions
+22
View File
@@ -0,0 +1,22 @@
<?php
/*
* PHPUnit bootstrap: load the site libraries once, with a fake database
* and a test configuration. PhpProcess runs it again in each subprocess.
*/
require_once __DIR__ . '/environment.php';
// publish/post.lib.php and the files it includes use paths relative to
// publish/. Each unit test runs there too (see TestCase), but PHPUnit
// needs the first directory back to find the test files named on the
// command line.
$cwd = getcwd();
chdir(XXX_ROOT . '/publish');
require_once XXX_ROOT . '/config.lib.php';
require_once XXX_ROOT . '/session.lib.php';
require_once XXX_ROOT . '/get_data.lib.php';
require_once XXX_ROOT . '/navigation.lib.php';
require_once XXX_ROOT . '/publish/post.lib.php';
require_once XXX_ROOT . '/lib/convert_entities.inc.php';
require_once XXX_ROOT . '/lib/smartypants.inc.php';
chdir($cwd);
unset($cwd);