Open
Conversation
Adds test infrastructure for Foundry using the WordPress test framework (wp-phpunit) with integration tests that run against a real MySQL database. Test coverage: - Model: CRUD lifecycle, state flags, query integration, reload - Query: WHERE clauses, ORDER BY, comparison operators, OR relation, pagination - QueryResults: count, iteration, array access, total available, as_array - Table: DDL create/conform, parse_index variants - Namespace functions: get_primary_column, save_many atomic/rollback/dry_run CI runs across PHP 7.4, 8.0, 8.1, 8.2 with MySQL 8.0. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…ST Controller Extends the test suite with 31 new tests covering: - Relations system (WithRelationships, HasManyAssociation, ManyToMany, RelationalQuery) - Builtin Term model (read-only WordPress term wrapper) - Importer (batch insert/update with dry-run support) - REST Controller (CRUD operations, route registration, error handling) Adds test helpers: Test_Parent_Model, Test_Child_Model, Test_Importer, Test_Controller. Note: Controller::test_get_items is skipped due to upstream bug where pagination params are passed as WHERE clauses to Query. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Foundry uses `mixed` type hints (PHP 8.0+) in QueryResults, so 7.4 is not supported. Added 8.3 and 8.4 to cover current PHP versions. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Replace all `\WP_*` and `\TypeError` root namespace references with proper `use` imports at the top of each file. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
wp-phpunit) with integration tests against a real MySQL databaseTest coverage
QueryTestModelTestQueryResultsTestTableTestNamespaceFunctionsTestRelationsTestTermTestImporterTestControllerTestNotes
ControllerTest::test_get_itemsis skipped:Controller::get_itemspasses WP default pagination params (page/per_page) as WHERE clauses toQuery, causing an undefined array key error. This is an upstream bug.TermTest::test_from_id_throws_for_invaliddocuments thatTerm::from_id()does not handleget_term()returning null (passes it tofrom_term()which throws TypeError).Files
composer.json— dev deps: phpunit, wp-phpunit, roots/wordpress-no-content, phpunit-polyfillsphpunit.xml.dist— PHPUnit 9 configtests/bootstrap.php+tests/wp-tests-config.php— WP test framework bootstraptests/helpers/— Test_Model, Failing_Test_Model, Test_Parent_Model, Test_Child_Model, Test_Importer, Test_Controllertests/database/— Query, Model, QueryResults, Table, NamespaceFunctions, Relations teststests/builtin/— Term teststests/api/— Controller teststests/ImporterTest.php— Importer tests.github/workflows/phpunit.yml— CI matrix (PHP 7.4-8.2, MySQL 8.0).gitignore— excludes vendor/, composer.lock, phpunit cacheRunning locally
composer install mysql -u root -e "CREATE DATABASE IF NOT EXISTS foundry_tests" vendor/bin/phpunitTest plan