diff --git a/.travis.yml b/.travis.yml index 4887be23d5..05aff999e5 100644 --- a/.travis.yml +++ b/.travis.yml @@ -3,44 +3,19 @@ # Tell Travis CI we're using PHP language: php -# PHP version used in first build configuration. php: + - "5.2" + - "5.3" + - "5.4" - "5.5" -# WordPress version used in first build configuration. -env: - - WP_VERSION=master - -# Next we define our matrix of additional build configurations to test against. -# The versions listed above will automatically create our first configuration, -# so it doesn't need to be re-defined below. - -# WP_VERSION specifies the tag to use. The way these tests are configured to run -# requires at least WordPress 3.8. Specify "master" to test against SVN trunk. - -# Note that Travis CI supports listing these above to automatically build a -# matrix of configurations, but we're being nice here by manually building a -# total of four configurations even though we're testing 4 versions of PHP -# along with 2 versions of WordPress (which would build 8 configs otherwise). -# This takes half as long to run while still providing adequate coverage. - -matrix: - include: - - php: "5.3" - env: WP_VERSION=master - - php: "5.4" - env: WP_VERSION=3.8 - - php: "5.2" - env: WP_VERSION=3.8 - # Clones WordPress and configures our testing environment. before_script: - export PLUGIN_SLUG=$(basename $(pwd)) - - git clone git://develop.git.wordpress.org/ /tmp/wordpress + - git clone --depth=1 git://develop.git.wordpress.org/ /tmp/wordpress - mkdir "/tmp/wordpress/src/wp-content/plugins/$PLUGIN_SLUG" - cp -r . "/tmp/wordpress/src/wp-content/plugins/$PLUGIN_SLUG/" - cd /tmp/wordpress - - git checkout $WP_VERSION - mysql -e "CREATE DATABASE wordpress_tests;" -uroot - cp wp-tests-config-sample.php wp-tests-config.php - sed -i "s/youremptytestdbnamehere/wordpress_tests/" wp-tests-config.php diff --git a/README.md b/README.md index cce3bbc1fa..d0664f22b6 100644 --- a/README.md +++ b/README.md @@ -24,6 +24,58 @@ working `PATH_INFO` on your server, but you don't need pretty permalinks enabled. +## Quick Setup +Want to test out WP-API and work on it? Here's how you can set up your own +testing environment in a few easy steps: + +1. Install [Vagrant](http://vagrantup.com/) and [VirtualBox](https://www.virtualbox.org/). +2. Clone [Chassis](https://github.com/sennza/Chassis): + + ```bash + git clone git@github.com:sennza/Chassis.git api-tester + ``` + +3. Grab a copy of WP API: + + ```bash + mkdir -p content/plugins + git clone git@github.com:WP-API/WP-API.git content/plugins/json-rest-api + ``` + +4. Start the virtual machine: + + ```bash + vagrant up + ``` + +5. Browse to http://vagrant.local/wp/wp-admin/ and activate the WP API plugin +6. Browse to http://vagrant.local/wp-json.php/ + + +### Testing +For testing, you'll need a little bit more: + +1. Install PHPUnit: + + ```bash + wget https://phar.phpunit.de/phpunit.phar + ``` + +2. Clone WordPress development (including tests): + + ```bash + git clone https://github.com/tierra/wordpress.git /tmp/wordpress + export WP_DEVELOP_DIR=/tmp/wordpress + ``` + +3. Run the testing suite: + + ```bash + cd /vagrant/content/plugins/json-rest-api/tests + phpunit + ``` + + ## Issue Tracking All tickets for the project are being tracked on the [GSoC Trac][]. Make sure you use the JSON REST API component. diff --git a/tests/test_json_plugin.php b/tests/test_json_plugin.php index a45a0cfc4e..b60eb98377 100644 --- a/tests/test_json_plugin.php +++ b/tests/test_json_plugin.php @@ -11,28 +11,6 @@ */ class WP_Test_JSON_Plugin extends WP_UnitTestCase { - /** - * If these tests are being run on Travis CI, verify that the version of - * WordPress installed is the version that we requested. - * - * @requires PHP 5.3 - */ - function test_wp_version() { - if ( !getenv( 'TRAVIS' ) ) - $this->markTestSkipped( 'Travis CI was not detected.' ); - - $requested_version = getenv( 'WP_VERSION' ) . '-src'; - - // The "master" version requires special handling. - if ( $requested_version == 'master-src' ) { - $file = file_get_contents( 'https://raw.github.com/tierra/wordpress/master/src/wp-includes/version.php' ); - preg_match( '#\$wp_version = \'([^\']+)\';#', $file, $matches ); - $requested_version = $matches[1]; - } - - $this->assertEquals( get_bloginfo( 'version' ), $requested_version ); - } - /** * The plugin should be installed and activated. */