File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -167,16 +167,22 @@ Feature: Create a wp-config file
167167 And a find-socket.php file:
168168 """
169169 <?php
170- if ( file_exists( '/tmp/mysqld.sock' ) ) {
171- echo '/tmp/mysqld.sock';
172- } else if ( file_exists( '/var/run/mysqld/mysqld.sock' ) ) {
173- echo '/var/run/mysqld/mysqld.sock';
174- } else if ( file_exists( '/tmp/mysql.sock' ) ) {
175- echo '/tmp/mysql.sock';
176- } else {
177- echo 'No socket found';
178- exit(1);
170+ $environment_socket = getenv( 'WP_CLI_TEST_DBSOCKET' );
171+ $vendor_dir = \WP_CLI\Tests\Context\FeatureContext::get_vendor_dir();
172+ $locations = [
173+ $environment_socket,
174+ "{$vendor_dir}/wp-cli/wp-cli-tests/utils/mapped_socket_folder/mysqld.sock",
175+ '/var/run/mysqld/mysqld.sock',
176+ '/tmp/mysql.sock',
177+ ];
178+ foreach ( $locations as $location ) {
179+ if ( ! empty( $location ) && file_exists( $location ) ) {
180+ echo $location;
181+ exit(0);
182+ }
179183 }
184+ echo 'No socket found';
185+ exit(1);
180186 """
181187
182188 When I run `php find-socket.php`
You can’t perform that action at this time.
0 commit comments