Skip to content
This repository was archived by the owner on Jun 2, 2025. It is now read-only.

WordPress unit tests #26

Merged
merged 5 commits into from
Mar 11, 2025
Merged

WordPress unit tests #26

merged 5 commits into from
Mar 11, 2025

Conversation

JanJakes
Copy link
Contributor

@JanJakes JanJakes commented Mar 8, 2025

This PR brings the WordPress tests/phpunit test suite to the SQLite integration.

Test commands

The PR adds the following commands:

  • composer run wp-setup — Fetch the WordPress repository and set it up to run tests with SQLite.
  • composer run wp-test-start — Start and install the testing environment.
  • composer run wp-test-phpunit — Run tests/phpunit with SQLite.
  • composer run wp-test-clean — Stop and remove the test containers.

Additionally, it also exposes a generic composer wp-run command to run any of the wordpress-delop commands.

CI wrapper

Since at the moment, some WordPress tests fail and error with SQLite, I also implemented a simple wrapper under .github/workflows/wp-tests-phpunit-run.js, that lists the expected errors and failures and verifies agains them. The script will report all the possibly wrong combinations:

  • Tests that were expected to error but did not.
  • Tests that errored unexpectedly.
  • Tests that were expected to fail but did not.
  • Tests that failed unexpectedly.

This wrapper us useful for CI, so that we have a passing CI job even though some tests fail, and we can explicitly state which ones those are.

Fixes

The test failures and errors revealed some issues in the SQLite driver, and I'm adding a few of the small and quick fixes in this PR. The more complex ones, such as correct temporary table handling and #17, will be handled in separate tickets.

@JanJakes JanJakes force-pushed the wp-unit-tests branch 5 times, most recently from 118737c to 8201efa Compare March 8, 2025 19:23
@JanJakes JanJakes force-pushed the wp-unit-tests branch 2 times, most recently from e1f9aec to 78bc4cc Compare March 10, 2025 16:22
@JanJakes JanJakes marked this pull request as ready for review March 10, 2025 16:53
@JanJakes JanJakes requested a review from adamziel March 10, 2025 16:53
Copy link
Contributor

@adamziel adamziel left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Really nice! Good idea making the job pass up to expected failures ❤️

@JanJakes JanJakes merged commit 545f95a into develop Mar 11, 2025
10 checks passed
@JanJakes JanJakes deleted the wp-unit-tests branch May 12, 2025 08:21
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants