Don't use WP_TESTS_DIR environment variable #2113

Closed
wants to merge 2 commits into
from

Projects

None yet

2 participants

@keesiemeijer

By using the environment variable WP_TESTS_DIR in bootstrap.php you can get an error Call to undefined function is_post_type_viewable(). This happens if the WP_TESTS_DIR points to the WordPress testing framework from a newer WP version as the WordPress version used in the tests.

See #2050

This pull request is a proof of concept where the WP_TESTS_DIR (variable) directory is no longer used. The testing framework from the same version as the installed WordPress version is installed in /tmp/wordpress-tests-lib.

This works for local testing but I have no idea if it will work in different environments.

@danielbachhuber
Member

We can't remove WP_TESTS_DIR without breaking backwards compatibility.

@danielbachhuber
Member

The WP_TESTS_DIR environment variable lets the developer use an already-installed version of the WP test harness, whose directory is set with WP_TESTS_DIR

@keesiemeijer

I understand you cannot remove it for backwards compatibility. The trac ticket assumes you only use the test framework from the installed branch. With VVV and and the current plugin scaffolding I get the undefined function is_post_type_viewable() error because the WP_TESTS_DIR is set in the bash_profile.

For myself, I will use the bootstrap.php and install-wp-tests.sh files from this pull request because I really don't want to add shims of future WordPress functions (used in the test framework) in my plugins.

@keesiemeijer keesiemeijer referenced this pull request in keesiemeijer/related-posts-by-taxonomy Oct 7, 2015
@keesiemeijer keesiemeijer Use test framework from same branch as WP install 9cad3f3
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment