Opened 11 years ago
Closed 10 years ago
#5376 closed enhancement (fixed)
PHPUnit Test Environment Variable
Reported by: | netweb | Owned by: | boonebgorges |
---|---|---|---|
Milestone: | 2.1 | Priority: | normal |
Severity: | normal | Version: | |
Component: | Build/Test Tools | Keywords: | has-patch |
Cc: |
Description
Switch from WP_TESTS_DIR
to WP_DEVELOP_DIR
There appears to be two methods to reference WordPress' Core PHPUnit Tests setting an environment variable.
WP_TESTS_DIR
- Used by BuddyPress and WP-CLI (https://github.com/wp-cli/sample-plugin)WP_DEVELOP_DIR
Used by @tierra/@bpetty and most probably WP-API and Jetpack
Presumably we'd all like to hook into each others PHPUnit Tests in the future and play nice together as per Boone's bootstrapping BP's tests in #4889.
I couldn't find any 'official docs' on which one we should use, either WP_TESTS_DIR
or WP_DEVELOP_DIR
but I think we should choose one that 'we all use' and I think the later appears to be the emerging theory, set the WP dev root and use it as the base for all the things.
(We have started to add PHPUnit Tests to bbPress #bbPress2542)
Attachments (1)
Change History (7)
#2
@
11 years ago
- Milestone changed from 2.0 to 2.1
I'm glad to fix this whenever, but I'm going to move it out of the milestone until it has a patch.
#3
@
11 years ago
- Owner set to boonebgorges
- Resolution set to fixed
- Status changed from new to closed
In 8415:
#4
@
10 years ago
- Keywords has-patch added; needs-patch removed
- Resolution fixed deleted
- Status changed from closed to reopened
Boone, thanks,
Though when WP_TESTS_DIR
is not set and only WP_DEVELOP_DIR
(same/equiv folder as WP_ROOT_DIR
) is set an error occurs when defining WP_TESTS_DIR
on Line#34 because WP_ROOT_DIR
does not exist.
Attached patch fixes this by defining WP_ROOT_DIR
== WP_DEVELOP_DIR
Then define( 'WP_TESTS_DIR', WP_ROOT_DIR . '/tests/phpunit' );
and all works as expected.
Thanks for the report. Given that we're already supporting and recommending
WP_TESTS_DIR
, we don't want to drop support for it. But we should supportWP_DEVELOP_DIR
as well, and I'm happy for that to become the recommended option.