10up / wp-hammer

ARCHIVED: Please see https://github.com/10up/wp-scrubber as replacement.
MIT License
150 stars 15 forks source link

Improve testing setup #3

Closed dnaber-de closed 7 years ago

dnaber-de commented 8 years ago

I'm currently dealing with a PR for #2 and want to write tests. But the current setup has two issues:

The configuration file is named phpunit.xml which is typically the name for the local copy of the distributed version of this file. If we could rename this file to phpunit.xml.dist and add phpunit.xml to the projects .gitignore, one would be able to have a local copy to adapt the test setup to the local environment. PHPUnit is aware of that and looks up for phpunit.xml first and falls back to phpunit.xml.dist if the first one is not available. Also PHPStorm supports the .dist file.

The other one is the idea of specifying the WordPress test directory via an environment variable or set it to a static directory. Typically one is managing many projects on a system and might want to test things with different WordPress versions. However, maybe you want to have a look at wp-tests-starter. This package allows you to bootstrap WordPress system tests on a per-project base. Database credentials are then typically stored in phpunit.xml locally. As everything (also the WordPress dev repository) is managed with composer, every contributor would have the exact same development and testing setup.

dnaber-de commented 8 years ago

Yes, and here comes the concrete issue:

Warning: require_once(/tmp/wordpress-tests-lib/includes/functions.php):

How does the actual setup has to look like? Isn't the WP_TESTS_DIR the WP dev repository git://develop.git.wordpress.org/ which looks like this?

ivankruchkoff commented 8 years ago

I'll take a look when I get a chance @dnaber-de

ivankruchkoff commented 7 years ago

closing this out