From 330bebb6e8c9528332aa32fad585a9fb0d591886 Mon Sep 17 00:00:00 2001 From: Jason Grey Date: Thu, 27 Aug 2026 17:40:44 -0500 Subject: [PATCH] docs: clarify CMS setup and test paths --- .devcontainer/devcontainer.json | 4 ++-- README.md | 30 +++++++++++++++++++++++++++++- wordpress/bin/install-wp-tests.sh | 11 ++++++----- wordpress/tests/bootstrap.php | 8 ++++++-- 4 files changed, 43 insertions(+), 10 deletions(-) diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json index 97b3f02..a9a1f4d 100644 --- a/.devcontainer/devcontainer.json +++ b/.devcontainer/devcontainer.json @@ -12,10 +12,10 @@ }, "ghcr.io/devcontainers/features/hugo:1": { "extended": true, - "version": "latest" + "version": "0.161.1" }, "ghcr.io/devcontainers/features/go:1": { - "version": "1.23" + "version": "1.25" } }, "postCreateCommand": "cd wordpress && composer install --ignore-platform-req=ext-intl --no-interaction 2>/dev/null; echo 'Ready'", diff --git a/README.md b/README.md index 1814003..d9f7c00 100644 --- a/README.md +++ b/README.md @@ -76,10 +76,38 @@ Then either: ```sh cd wordpress/ -bin/install-wp-tests.sh wordpress_test root '' localhost latest +export TEST_TMP_DIR="${HOME}/tmp/htmltrust-cms-tests" +mkdir -p "$TEST_TMP_DIR" +TMPDIR="$TEST_TMP_DIR" \ +WP_TESTS_DIR="$TEST_TMP_DIR/wordpress-tests-lib" \ +WP_CORE_DIR="$TEST_TMP_DIR/wordpress" \ +bin/install-wp-tests.sh wordpress_test root '' localhost 6.9.4 +TMPDIR="$TEST_TMP_DIR" \ +WP_TESTS_DIR="$TEST_TMP_DIR/wordpress-tests-lib" \ +WP_CORE_DIR="$TEST_TMP_DIR/wordpress" \ composer test ``` +The installer downloads WordPress and the WordPress test library into the +disposable directory under `$HOME/tmp`. Set `DB_HOST` in the installer command +when MySQL or MariaDB is running in a container. The test suite expects the +database named by the first argument to exist or for the database user to be +allowed to create it. + +For a development container, open this repository in VS Code Dev Containers. +The configuration provides PHP 8.3, Composer, Node 22, Go 1.25, and Hugo +Extended 0.161.1. Run the same commands above from `wordpress/` after the +container starts. + +### Using the reference server + +The WordPress plugin's signing client is compatible with the Node reference +server in `htmltrust-server-reference`. Start that server at +`http://localhost:3000`, then configure the plugin's server profile with that +URL. The plugin uses the server's author API key for `POST /api/content/sign` +and sends the publication origin as the `domain` field. Use an origin such as +`https://example.com`, including the scheme and optional port. + ## The HTML Protocol Signed content is embedded with a `` wrapper around the actual signed content: diff --git a/wordpress/bin/install-wp-tests.sh b/wordpress/bin/install-wp-tests.sh index 02655bb..962dca9 100755 --- a/wordpress/bin/install-wp-tests.sh +++ b/wordpress/bin/install-wp-tests.sh @@ -12,8 +12,9 @@ DB_HOST=${4-localhost} WP_VERSION=${5-latest} SKIP_DB_CREATE=${6-false} -TMPDIR=${TMPDIR-/tmp} +TMPDIR=${TMPDIR-${HOME:-.}/tmp} TMPDIR=$(echo $TMPDIR | sed -e "s/\/$//") +mkdir -p "$TMPDIR" WP_TESTS_DIR=${WP_TESTS_DIR-$TMPDIR/wordpress-tests-lib} WP_CORE_DIR=${WP_CORE_DIR-$TMPDIR/wordpress/} @@ -42,9 +43,9 @@ elif [[ $WP_VERSION == 'nightly' || $WP_VERSION == 'trunk' ]]; then WP_TESTS_TAG="trunk" else # http serves a single offer, whereas https serves multiple. we only want one - download http://api.wordpress.org/core/version-check/1.7/ /tmp/wp-latest.json - grep '[0-9]+\.[0-9]+(\.[0-9]+)?' /tmp/wp-latest.json - LATEST_VERSION=$(grep -o '"version":"[^"]*' /tmp/wp-latest.json | sed 's/"version":"//') + download http://api.wordpress.org/core/version-check/1.7/ "$TMPDIR/wp-latest.json" + grep '[0-9]+\.[0-9]+(\.[0-9]+)?' "$TMPDIR/wp-latest.json" + LATEST_VERSION=$(grep -o '"version":"[^"]*' "$TMPDIR/wp-latest.json" | sed 's/"version":"//') if [[ -z "$LATEST_VERSION" ]]; then echo "Latest WordPress version could not be found" exit 1 @@ -152,4 +153,4 @@ install_db() { install_wp install_test_suite -install_db \ No newline at end of file +install_db diff --git a/wordpress/tests/bootstrap.php b/wordpress/tests/bootstrap.php index 0004acb..4545349 100644 --- a/wordpress/tests/bootstrap.php +++ b/wordpress/tests/bootstrap.php @@ -8,7 +8,11 @@ $_tests_dir = getenv( 'WP_TESTS_DIR' ); if ( ! $_tests_dir ) { - $_tests_dir = rtrim( sys_get_temp_dir(), '/\\' ) . '/wordpress-tests-lib'; + $test_tmp_dir = getenv( 'TMPDIR' ); + if ( ! $test_tmp_dir ) { + $test_tmp_dir = rtrim( getenv( 'HOME' ) ?: '.', '/\\' ) . '/tmp'; + } + $_tests_dir = rtrim( $test_tmp_dir, '/\\' ) . '/wordpress-tests-lib'; } if ( ! file_exists( $_tests_dir . '/includes/functions.php' ) ) { @@ -40,4 +44,4 @@ function _manually_load_plugin() { // Include test case base classes require_once dirname( __FILE__ ) . '/class-content-signing-test-case.php'; require_once dirname( __FILE__ ) . '/class-content-signing-db-test-case.php'; -require_once dirname( __FILE__ ) . '/class-content-signing-api-client-test-case.php'; \ No newline at end of file +require_once dirname( __FILE__ ) . '/class-content-signing-api-client-test-case.php';