Skip to content

Commit 5f5020a

Browse files
committed
add the favor and groups
1 parent 6fe66e9 commit 5f5020a

File tree

2 files changed

+48
-1
lines changed

2 files changed

+48
-1
lines changed

.env.default

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,3 +65,14 @@ export WPT_DEBUG=
6565
# Use 1 to validate, and 0 to not validate
6666
export WPT_CERTIFICATE_VALIDATION=1
6767

68+
# WordPress flavor
69+
# 0 = WordPress (simple version)
70+
# 1 = WordPress Multisite
71+
export WPT_FLAVOR=1
72+
73+
# Extra tests (groups)
74+
# 0 = none
75+
# 1 = ajax
76+
# 2 = ms-files
77+
# 3 = external-http
78+
export WPT_EXTRATESTS=0

test.php

Lines changed: 37 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,42 @@
2727
$WPT_SSH_OPTIONS = trim( getenv( 'WPT_SSH_OPTIONS' ) ) ? : '-o StrictHostKeyChecking=no';
2828
$WPT_PHP_EXECUTABLE = trim( getenv( 'WPT_PHP_EXECUTABLE' ) ) ? : 'php';
2929

30+
// Uses the flavor (usually to test WordPress Multisite)
31+
$WPT_FLAVOR_INI = trim( getenv( 'WPT_FLAVOR' ) );
32+
switch( $WPT_FLAVOR_INI ) {
33+
case 0:
34+
$WPT_FLAVOR_TXT = ''; // Simple WordPress
35+
break;
36+
case 1:
37+
$WPT_FLAVOR_TXT = ' -c tests/phpunit/multisite.xml'; // WordPress Multisite
38+
break;
39+
default:
40+
$WPT_FLAVOR_TXT = '';
41+
break;
42+
}
43+
unset( $WPT_FLAVOR_INI );
44+
45+
// Uses the flavor (usually to test WordPress Multisite)
46+
$WPT_EXTRATESTS_INI = trim( getenv( 'WPT_EXTRATESTS' ) );
47+
switch( $WPT_EXTRATESTS_INI ) {
48+
case 0:
49+
$WPT_EXTRATESTS_TXT = ''; // no extra tests
50+
break;
51+
case 1:
52+
$WPT_EXTRATESTS_TXT = ' --group ajax'; // ajax tests
53+
break;
54+
case 2:
55+
$WPT_EXTRATESTS_TXT = ' --group ms-files'; // ms-files tests
56+
break;
57+
case 3:
58+
$WPT_EXTRATESTS_TXT = ' --group external-http'; // external-http tests
59+
break;
60+
default:
61+
$WPT_EXTRATESTS_TXT = '';
62+
break;
63+
}
64+
unset( $WPT_EXTRATESTS_INI );
65+
3066
/**
3167
* Determines the PHPUnit command to execute the test suite.
3268
* Retrieves the PHPUnit command from the environment variable 'WPT_PHPUNIT_CMD'. If the environment
@@ -36,7 +72,7 @@
3672
*/
3773
$WPT_PHPUNIT_CMD = trim( getenv( 'WPT_PHPUNIT_CMD' ) );
3874
if( empty( $WPT_PHPUNIT_CMD ) ) {
39-
$WPT_PHPUNIT_CMD = 'cd ' . escapeshellarg( $WPT_TEST_DIR ) . ' && ' . $WPT_PHP_EXECUTABLE . ' ./vendor/phpunit/phpunit/phpunit --dont-report-useless-tests';
75+
$WPT_PHPUNIT_CMD = 'cd ' . escapeshellarg( $WPT_TEST_DIR ) . ' && ' . $WPT_PHP_EXECUTABLE . ' ./vendor/phpunit/phpunit/phpunit --dont-report-useless-tests' . $WPT_FLAVOR_TXT;
4076
}
4177

4278
// If an SSH connection string is provided, prepend the SSH command to the PHPUnit execution command.

0 commit comments

Comments
 (0)