Skip to content

Commit afc2095

Browse files
committed
Try conditionally downloading PHPUnit
1 parent 2c1db3e commit afc2095

File tree

1 file changed

+40
-2
lines changed

1 file changed

+40
-2
lines changed

features/install-wp-tests.feature

Lines changed: 40 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,25 @@ Feature: Scaffold install-wp-tests.sh tests
2525
"""
2626
No
2727
"""
28+
And a get-phpunit-phar-url.php file:
29+
"""
30+
<?php
31+
$version = 4;
32+
if(PHP_VERSION_ID >= 50600) {
33+
$version = 5;
34+
}
35+
if(PHP_VERSION_ID >= 70000) {
36+
$version = 6;
37+
}
38+
if(PHP_VERSION_ID >= 70100) {
39+
$version = 7;
40+
}
41+
echo "https://phar.phpunit.de/phpunit-{$version}.phar";
42+
"""
43+
And I run `wp eval-file get-phpunit-phar-url.php --skip-wordpress`
44+
And save STDOUT as {PHPUNIT_PHAR_URL}
45+
And I run `wget -O phpunit {PHPUNIT_PHAR_URL}`
46+
And I run `chmod +x phpunit`
2847
And I run `wp plugin path`
2948
And save STDOUT as {PLUGIN_DIR}
3049
And I run `wp scaffold plugin hello-world`
@@ -84,7 +103,7 @@ Feature: Scaffold install-wp-tests.sh tests
84103
wp_cli_test_scaffold
85104
"""
86105

87-
When I run `WP_TESTS_DIR=/tmp/behat-wordpress-tests-lib phpunit -c {PLUGIN_DIR}/hello-world/phpunit.xml.dist`
106+
When I run `WP_TESTS_DIR=/tmp/behat-wordpress-tests-lib ./phpunit -c {PLUGIN_DIR}/hello-world/phpunit.xml.dist`
88107
Then the return code should be 0
89108

90109
When I try `WP_TESTS_DIR=/tmp/behat-wordpress-tests-lib WP_CORE_DIR=/tmp/behat-wordpress /usr/bin/env bash {PLUGIN_DIR}/hello-world/bin/install-wp-tests.sh wp_cli_test_scaffold {DB_USER} {DB_PASSWORD} {DB_HOST} latest < affirmative-response`
@@ -112,6 +131,25 @@ Feature: Scaffold install-wp-tests.sh tests
112131
@require-php-5.6
113132
Scenario: Install WordPress from trunk
114133
Given a WP install
134+
And a get-phpunit-phar-url.php file:
135+
"""
136+
<?php
137+
$version = 4;
138+
if(PHP_VERSION_ID >= 50600) {
139+
$version = 5;
140+
}
141+
if(PHP_VERSION_ID >= 70000) {
142+
$version = 6;
143+
}
144+
if(PHP_VERSION_ID >= 70100) {
145+
$version = 7;
146+
}
147+
echo "https://phar.phpunit.de/phpunit-{$version}.phar";
148+
"""
149+
And I run `wp eval-file get-phpunit-phar-url.php --skip-wordpress`
150+
And save STDOUT as {PHPUNIT_PHAR_URL}
151+
And I run `wget -O phpunit {PHPUNIT_PHAR_URL}`
152+
And I run `chmod +x phpunit`
115153
And I run `wp plugin path`
116154
And save STDOUT as {PLUGIN_DIR}
117155
And I run `wp scaffold plugin hello-world`
@@ -184,7 +222,7 @@ Feature: Scaffold install-wp-tests.sh tests
184222
wp_cli_test_scaffold
185223
"""
186224
187-
When I run `WP_TESTS_DIR=/tmp/behat-wordpress-tests-lib phpunit -c {PLUGIN_DIR}/hello-world/phpunit.xml.dist`
225+
When I run `WP_TESTS_DIR=/tmp/behat-wordpress-tests-lib ./phpunit -c {PLUGIN_DIR}/hello-world/phpunit.xml.dist`
188226
Then the return code should be 0
189227
190228
Scenario: Install WordPress 3.7 and phpunit will not run

0 commit comments

Comments
 (0)