mirror of
https://ghproxy.net/https://github.com/fairpm/fair-plugin.git
synced 2026-08-10 13:50:27 +08:00
HTTP tests exercise plugin filter/endpoint behavior at the HTTP layer inside the Docker WordPress instance. tests/http/bootstrap.php: loads WP + plugin with admin includes. tests/http/phpunit.xml: PHPUnit config for HTTP test suite. SaltApiHttpTest (3 tests): salt API URL interception, 64-char salt values, unrelated URL passthrough. DefaultRepoHttpTest (5 tests): domain configuration, non-WP.org passthrough, filter registration, plugins/themes API interception. AvatarHttpTest (4 tests): should_replace_url detection, SVG default avatar generation, avatar alt text for users. Updated run-integration.sh to run HTTP tests after integration tests, reporting both results separately. 12 integration + 12 HTTP = 24 Docker tests (22 pass, 2 skipped), 76 assertions. Zero leftover containers confirmed. Signed-off-by: Chuck Adams <chaz@chaz.works>
27 lines
848 B
PHP
27 lines
848 B
PHP
<?php
|
|
/**
|
|
* HTTP test bootstrap — runs inside Docker wp-cli container.
|
|
*
|
|
* Loads WordPress and the plugin. HTTP tests make real HTTP requests
|
|
* to the WordPress container and verify HTTP-level behavior.
|
|
*
|
|
* @package FAIR
|
|
*/
|
|
|
|
// Composer autoloader.
|
|
$plugin_dir = '/var/www/html/wp-content/plugins/fair-plugin';
|
|
require_once "{$plugin_dir}/vendor/autoload.php";
|
|
|
|
// Load WordPress.
|
|
define( 'WP_USE_THEMES', false );
|
|
define( 'FAIR_DEFAULT_REPO_DOMAIN', 'mock-server:8080' );
|
|
define( 'FAIR_PLC_DIRECTORY_URL', 'http://mock-server:8080' );
|
|
$_SERVER['HTTP_HOST'] = 'integration.local';
|
|
require_once '/var/www/html/wp-load.php';
|
|
|
|
// Load the plugin.
|
|
require_once "{$plugin_dir}/plugin.php";
|
|
|
|
// Load admin includes needed by HTTP tests.
|
|
require_once ABSPATH . 'wp-admin/includes/user.php';
|
|
require_once ABSPATH . 'wp-admin/includes/plugin.php';
|