Skip to content

Commit 559984c

Browse files
committed
certificate validation
- local certificate validation - fix the verbose
1 parent 3f8fc4f commit 559984c

File tree

3 files changed

+17
-6
lines changed

3 files changed

+17
-6
lines changed

.env.default

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,4 +59,9 @@ export WPT_SSH_PRIVATE_KEY_BASE64=
5959

6060
# Output logging
6161
# Use 'verbose' to increase verbosity
62-
export WPT_DEBUG=
62+
export WPT_DEBUG=
63+
64+
# Certificate validation
65+
# Use 1 to validate, and 0 to not validate
66+
export WPT_CERTIFICATE_VALIDATION=1
67+

prepare.php

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@
2828
$WPT_SSH_OPTIONS = trim( getenv( 'WPT_SSH_OPTIONS' ) ) ? : '-o StrictHostKeyChecking=no';
2929
$WPT_TEST_DIR = trim( getenv( 'WPT_TEST_DIR' ) );
3030
$WPT_PHP_EXECUTABLE = trim( getenv( 'WPT_PHP_EXECUTABLE' ) ) ? : 'php';
31+
$WPT_CERTIFICATE_VALIDATION = trim( getenv( 'WPT_CERTIFICATE_VALIDATION' ) );
3132

3233
/**
3334
* Determines if the debug mode is enabled based on the 'WPT_DEBUG' environment variable.
@@ -41,8 +42,6 @@
4142
break;
4243
case 1:
4344
case 'true':
44-
$WPT_DEBUG = true;
45-
break;
4645
case 'verbose':
4746
$WPT_DEBUG = 'verbose';
4847
break;
@@ -98,6 +97,15 @@
9897

9998
}
10099

100+
/**
101+
* Don't validate the TLS certificate
102+
* Useful for local environments
103+
*/
104+
$certificate_validation = '';
105+
if( ! $WPT_CERTIFICATE_VALIDATION ) {
106+
$certificate_validation .= ' --no-check-certificate';
107+
}
108+
101109
/**
102110
* Performs a series of operations to set up the test environment. This includes creating a preparation directory,
103111
* cloning the WordPress development repository, downloading the WordPress importer plugin, and preparing the environment with npm.
@@ -113,7 +121,7 @@
113121
'git clone --depth=1 https://github.com/WordPress/wordpress-develop.git ' . escapeshellarg( $WPT_PREPARE_DIR ),
114122

115123
// Download the WordPress importer plugin zip file to the specified plugins directory.
116-
'wget -O ' . escapeshellarg( $WPT_PREPARE_DIR . '/tests/phpunit/data/plugins/wordpress-importer.zip' ) . ' https://downloads.wordpress.org/plugin/wordpress-importer.zip',
124+
'wget -O ' . escapeshellarg( $WPT_PREPARE_DIR . '/tests/phpunit/data/plugins/wordpress-importer.zip' ) . ' https://downloads.wordpress.org/plugin/wordpress-importer.zip' . $certificate_validation,
117125

118126
// Change directory to the plugin directory, unzip the WordPress importer plugin, and remove the zip file.
119127
'cd ' . escapeshellarg( $WPT_PREPARE_DIR . '/tests/phpunit/data/plugins/' ) . '; unzip wordpress-importer.zip; rm wordpress-importer.zip',

report.php

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,8 +41,6 @@
4141
break;
4242
case 1:
4343
case 'true':
44-
$WPT_DEBUG = true;
45-
break;
4644
case 'verbose':
4745
$WPT_DEBUG = 'verbose';
4846
break;

0 commit comments

Comments
 (0)