Skip to content

Commit 1cbb3ad

Browse files
authored
Merge pull request #102 from wp-cli/77-test-script
Run Behat tests on CI with bin/test.sh
2 parents 05c0883 + b8cd689 commit 1cbb3ad

File tree

6 files changed

+22
-3
lines changed

6 files changed

+22
-3
lines changed

.travis.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,4 +46,4 @@ before_script:
4646
- composer validate
4747

4848
script:
49-
- behat --format progress --strict
49+
- bash bin/test.sh

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -120,6 +120,7 @@ The files generated by this command include:
120120
* `.travis.yml` is the configuration file for Travis CI.
121121
* `bin/install-package-tests.sh` will configure your environment to run
122122
the tests.
123+
* `bin/test.sh` is a test runner that respects contextual Behat tags.
123124
* `features/load-wp-cli.feature` is a basic test to confirm WP-CLI can
124125
load.
125126
* `features/bootstrap`, `features/steps`, `features/extra` are Behat

bin/test.sh

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
#!/bin/bash
2+
3+
set -ex
4+
5+
# Run the functional tests
6+
BEHAT_TAGS=$(php utils/behat-tags.php)
7+
behat --format progress $BEHAT_TAGS --strict

circle.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,6 @@ test:
2424
pre:
2525
- composer validate
2626
override:
27-
- WP_VERSION=latest behat --format progress --strict
27+
- WP_VERSION=latest bash bin/test.sh
2828
- rm -rf '/tmp/wp-cli-test core-download-cache'
29-
- WP_VERSION=trunk behat --format progress --strict
29+
- WP_VERSION=trunk bash bin/test.sh

features/scaffold-package-tests.feature

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ Feature: Scaffold the test suite for an existing package
3434
Then STDOUT should not be empty
3535
And the community-command/.travis.yml file should exist
3636
And the community-command/bin/install-package-tests.sh file should exist
37+
And the community-command/bin/test.sh file should exist
3738
And the community-command/utils/behat-tags.php file should contain:
3839
"""
3940
require-wp
@@ -84,6 +85,10 @@ Feature: Scaffold the test suite for an existing package
8485
"""
8586
bash bin/install-package-tests.sh
8687
"""
88+
And the community-command/.travis.yml file should contain:
89+
"""
90+
bash bin/test.sh
91+
"""
8792
And the community-command/circle.yml file should not exist
8893

8994
Scenario: Scaffolds .travis.yml configuration file with argument
@@ -94,4 +99,8 @@ Feature: Scaffold the test suite for an existing package
9499
"""
95100
bash bin/install-package-tests.sh
96101
"""
102+
And the community-command/circle.yml file should contain:
103+
"""
104+
bash bin/test.sh
105+
"""
97106
And the community-command/.travis.yml file should not exist

src/ScaffoldPackageCommand.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -415,6 +415,7 @@ public function package_readme( $args, $assoc_args ) {
415415
* * `.travis.yml` is the configuration file for Travis CI.
416416
* * `bin/install-package-tests.sh` will configure your environment to run
417417
* the tests.
418+
* * `bin/test.sh` is a test runner that respects contextual Behat tags.
418419
* * `features/load-wp-cli.feature` is a basic test to confirm WP-CLI can
419420
* load.
420421
* * `features/bootstrap`, `features/steps`, `features/extra` are Behat
@@ -503,6 +504,7 @@ public function package_tests( $args, $assoc_args ) {
503504
$package_root => array(
504505
'templates/load-wp-cli.feature' => $features_dir,
505506
'bin/install-package-tests.sh' => $bin_dir,
507+
'bin/test.sh' => $bin_dir,
506508
),
507509
);
508510

0 commit comments

Comments
 (0)