OSDN Git Service

tests: first pass at using global PHPUnit and Behat
authorscribu <mail@scribu.net>
Mon, 12 Aug 2013 09:40:17 +0000 (12:40 +0300)
committerscribu <mail@scribu.net>
Mon, 12 Aug 2013 09:40:17 +0000 (12:40 +0300)
CONTRIBUTING.md
bin/ci/install_dependencies.sh
bin/ci/run_build.sh
composer.json

index a3d736e..07a7bcf 100644 (file)
@@ -21,20 +21,30 @@ There are two types of tests:
 * unit tests, implemented using [PHPUnit](http://phpunit.de/)
 * functional tests, implemented using [Behat](http://behat.org)
 
-All the test dependencies can be installed using [Composer](http://getcomposer.org/):
+### Unit tests
 
-    php composer.phar install --dev
+Assuming you have `~/.wp-cli/bin/` in your PATH, you can do:
 
-### Unit tests
+```bash
+# Install PHPUnit
+curl http://pear.phpunit.de/get/phpunit.phar > ~/.wp-cli/bin/phpunit
+chmod +x ~/.wp-cli/bin/phpunit
 
 To run the unit tests, just execute:
 
-    vendor/bin/phpunit
+    phpunit
 
 The test files are in the `tests/` directory.
 
 ### Functional tests
 
+Assuming you have `~/.wp-cli/bin/` in your PATH, to install Behat, you can do:
+
+```bash
+curl http://behat.org/downloads/behat.phar > ~/.wp-cli/bin/behat
+chmod +x ~/.wp-cli/bin/behat
+```
+
 Before running the functional tests, you'll need a MySQL user called `wp_cli_test` with the
 password `password1` that has full privileges on the MySQL database `wp_cli_test`.
 Running the following as root in MySQL should do the trick:
@@ -43,11 +53,11 @@ Running the following as root in MySQL should do the trick:
 
 Then, to run the entire test suite:
 
-    vendor/bin/behat --expand
+    behat --expand
 
 Or to test a single feature:
 
-    vendor/bin/behat features/core.feature
+    behat features/core.feature
 
 More info can be found from `vendor/bin/behat --help`.
 
index c756510..7e83e2d 100755 (executable)
@@ -4,8 +4,12 @@
 
 set -ex
 
+# install Behat
+sudo curl http://behat.org/downloads/behat.phar > /usr/bin/behat
+chmod +x /usr/bin/behat
+
 # install dependencies
-composer install --dev --no-interaction --prefer-source
+composer install --no-interaction --prefer-source
 composer require d11wtq/boris=dev-master --no-interaction --prefer-source
 
 # set up WP install
index 3ed2e35..2711478 100755 (executable)
@@ -2,6 +2,6 @@
 
 set -ex
 
-vendor/bin/phpunit
+phpunit
 
-vendor/bin/behat --format progress
+behat --format progress
index c852f8b..75262e7 100644 (file)
        "suggest": {
                "d11wtq/boris": "Enhanced `wp shell` functionality"
        },
-       "require-dev": {
-               "phpunit/phpunit": "~3.7",
-               "behat/behat": "~2.4"
-       },
        "autoload": {
                "psr-0": { "WP_CLI": "php" }
        }