{"id":20204418,"url":"https://github.com/rask/wp-test-framework","last_synced_at":"2025-07-22T01:04:03.398Z","repository":{"id":62533383,"uuid":"121689014","full_name":"rask/wp-test-framework","owner":"rask","description":"A librarized version of the WordPress core PHPUnit test framework","archived":false,"fork":false,"pushed_at":"2022-01-28T10:52:35.000Z","size":3985,"stargazers_count":4,"open_issues_count":2,"forks_count":2,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-06-17T00:29:56.578Z","etag":null,"topics":["phpunit","testing-framework","wordpress","wordpress-development","wordpress-php-library"],"latest_commit_sha":null,"homepage":"","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/rask.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2018-02-15T22:11:11.000Z","updated_at":"2022-08-11T14:24:45.000Z","dependencies_parsed_at":"2022-11-02T14:46:36.035Z","dependency_job_id":null,"html_url":"https://github.com/rask/wp-test-framework","commit_stats":null,"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"purl":"pkg:github/rask/wp-test-framework","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rask%2Fwp-test-framework","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rask%2Fwp-test-framework/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rask%2Fwp-test-framework/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rask%2Fwp-test-framework/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/rask","download_url":"https://codeload.github.com/rask/wp-test-framework/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rask%2Fwp-test-framework/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":265699013,"owners_count":23813315,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["phpunit","testing-framework","wordpress","wordpress-development","wordpress-php-library"],"created_at":"2024-11-14T05:13:05.491Z","updated_at":"2025-07-22T01:04:03.366Z","avatar_url":"https://github.com/rask.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# rask/wp-test-framework\n\nExtracted and librarized version of WordPress core's PHPUnit test framework to help with writing integration tests in WordPress plugins and themes.\n\nThe test framework is fetched from `https://develop.svn.wordpress.org/trunk/tests/phpunit/` and is stored in `src/phpunit` (with minor changes to make it work better as a Composer package).\n\nThe sources are updated when needed, so there may be minor differences between the core framework and this extracted library version. Let the maintainers know if there are bigger changes which need to be merged here.\n\n## Installation\n\nThis library should be installed as a Composer dependency inside your plugin or theme:\n\n    $ composer require --dev rask/wp-test-framework\n    \n### WordPress testing installation setup\n\nYou need to have a WordPress instance downloaded locally into a directory where your user account can load and execute PHP code from:\n\n    $ cd /home/you/wordpress\n    $ wp-cli core download\n    \nNext, you do not need to install WP in there but instead you need a `wp-tests-config.php` file to be available. It is similar to a regular `wp-config.php` but is solely for testing purposes.\n\nYou can find an example configuration at `https://develop.svn.wordpress.org/trunk/wp-tests-config-sample.php`. Copy the contents into the WordPress root\ndirectory (`ABSPATH`) and set up the configuration for your system (databases, etc.).\n\nYour plugin/theme can (and probably should) live outside the WordPress testing installation.\n\n## Setting up PHPUnit for your plugin/theme\n\nInside your plugin/theme directory you need to setup PHPUnit. Any regular-ish `phpunit.xml` configuration should work. In your PHPUnit bootstrap file you should load the WordPress test framework as such:\n\n    \u003c?php\n    \n    require_once './vendor/autoload.php';\n    \n    \\rask\\WpTestFramework\\Framework::load();\n\nThen you should load your plugin or theme. In the same bootstrap file you can do the following:\n\n    \u003c?php\n    \n    require_once './vendor/autoload.php';\n    \n    \\rask\\WpTestFramework\\Framework::load();\n    \n    // Load your plugin\n    \n    require_once dirname(__DIR__) . '/my-plugin.php';\n    \n    // You can also add WP configuration here if you need to\n    \nNow your plugin tests are bootstrapped to use the test framework and your test cases can now act as integration tests that use the whole WordPress stack. In other words you can run tests just like WordPress core tests are run!\n\n## Running your tests\n\nYou need to define an environment variable that contains a filesystem path (absolute or relative) to the WordPress testing installation you created earlier. The environment variable name is\n\n    WP_TESTS_INSTALLATION\n    \nYou can use the environment variable with PHPUnit as follows:\n\n    $ WP_TESTS_INSTALLATION=/home/you/wordpress phpunit\n    \nNow you should see the WordPress get loaded and installed and you can start writing tests against the WordPress stack.\n\n## Contributing\n\nThe upstream test framework might need mirroring from time to time so feel free to ping the maintainers in case a refresh is needed.\n\nSubmitting code is OK as long as it fits the purpose of this library and works. Documentation is also very welcome.\n\nIf something does not work as expected be sure to raise an issue.\n\n## Other notes\n\nThanks for the WordPress team for the test framework.\n\n## License\n\nAs the source framework and WordPress in general is GPLv2+, this library uses GPLv3+. See [LICENSE.md](LICENSE.md).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frask%2Fwp-test-framework","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frask%2Fwp-test-framework","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frask%2Fwp-test-framework/lists"}