Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion tests/phpunit/includes/secrets/class-mock-store.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ public function get( string $name, bool $network = false ) {

$key = $this->key( $name, $network );

return array_key_exists( $key, $this->records ) ? $this->records[ $key ] : null;
return $this->records[ $key ] ?? null;
}

public function set( string $name, array $record, bool $network = false ) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ public function set_up() {

require_once ABSPATH . 'wp-admin/includes/plugin.php';

$this->orig_paused_plugins = isset( $GLOBALS['_paused_plugins'] ) ? $GLOBALS['_paused_plugins'] : null;
$this->orig_paused_plugins = $GLOBALS['_paused_plugins'] ?? null;

$GLOBALS['_paused_plugins'] = array();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ private function create_mock_embedding_model(
$result,
?ModelMetadata $metadata = null
): ModelInterface {
$metadata = $metadata ?? $this->create_test_embedding_model_metadata();
$metadata ??= $this->create_test_embedding_model_metadata();

$provider_metadata = new ProviderMetadata(
'mock',
Expand Down
4 changes: 2 additions & 2 deletions tests/phpunit/tests/dependencies/wpPrefetchAdminAssets.php
Original file line number Diff line number Diff line change
Expand Up @@ -656,10 +656,10 @@ public function test_login_skips_scripts_printed_in_footer(): void {
if ( 'SCRIPT' === $processor->get_tag() ) {
$src = $processor->get_attribute( 'src' );
if ( is_string( $src ) && in_array( basename( (string) wp_parse_url( $src, PHP_URL_PATH ) ), array( 'jquery.js', 'jquery.min.js' ), true ) ) {
$jquery_index = $jquery_index ?? $tag_index;
$jquery_index ??= $tag_index;
}
} elseif ( 'LINK' === $processor->get_tag() && 'prefetch' === $processor->get_attribute( 'rel' ) ) {
$first_prefetch_index = $first_prefetch_index ?? $tag_index;
$first_prefetch_index ??= $tag_index;
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ class Tests_Error_Protection_wpRecoveryModeLinkService extends WP_UnitTestCase {
public function set_up() {
parent::set_up();

$this->orig_pagenow = isset( $GLOBALS['pagenow'] ) ? $GLOBALS['pagenow'] : null;
$this->orig_pagenow = $GLOBALS['pagenow'] ?? null;
$this->orig_get = $_GET;
$_GET = array();

Expand Down
2 changes: 1 addition & 1 deletion tests/phpunit/tests/link/getSearchLink.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ class Tests_Link_GetSearchLink extends WP_UnitTestCase {

public static function set_up_before_class() {
parent::set_up_before_class();
self::$original_search_query = isset( $GLOBALS['wp_query']->query_vars['s'] ) ? $GLOBALS['wp_query']->query_vars['s'] : '';
self::$original_search_query = $GLOBALS['wp_query']->query_vars['s'] ?? '';
}

public function tear_down() {
Expand Down
2 changes: 1 addition & 1 deletion tests/phpunit/tests/load/wpGetServerProtocol.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ class Tests_Load_WpGetServerProtocol extends WP_UnitTestCase {
public function set_up() {
parent::set_up();

$this->original_server_protocol = isset( $_SERVER['SERVER_PROTOCOL'] ) ? $_SERVER['SERVER_PROTOCOL'] : null;
$this->original_server_protocol = $_SERVER['SERVER_PROTOCOL'] ?? null;
}

public function tear_down() {
Expand Down
4 changes: 2 additions & 2 deletions tests/phpunit/tests/load/wpIsJsonRequest.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@ class Tests_Load_WpIsJsonRequest extends WP_UnitTestCase {
public function set_up() {
parent::set_up();

$this->original_http_accept = isset( $_SERVER['HTTP_ACCEPT'] ) ? $_SERVER['HTTP_ACCEPT'] : null;
$this->original_content_type = isset( $_SERVER['CONTENT_TYPE'] ) ? $_SERVER['CONTENT_TYPE'] : null;
$this->original_http_accept = $_SERVER['HTTP_ACCEPT'] ?? null;
$this->original_content_type = $_SERVER['CONTENT_TYPE'] ?? null;
}

public function tear_down() {
Expand Down
2 changes: 1 addition & 1 deletion tests/phpunit/tests/load/wpIsMaintenanceMode.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ public function set_up() {
$this->original_installing = wp_installing();

foreach ( array( 'wp_scrape_key', 'wp_scrape_nonce' ) as $key ) {
$this->original_scrape_request[ $key ] = array_key_exists( $key, $_REQUEST ) ? $_REQUEST[ $key ] : null;
$this->original_scrape_request[ $key ] = $_REQUEST[ $key ] ?? null;
}

$this->delete_maintenance_file();
Expand Down
4 changes: 2 additions & 2 deletions tests/phpunit/tests/load/wpIsXmlRequest.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@ class Tests_Load_WpIsXmlRequest extends WP_UnitTestCase {
public function set_up() {
parent::set_up();

$this->original_http_accept = isset( $_SERVER['HTTP_ACCEPT'] ) ? $_SERVER['HTTP_ACCEPT'] : null;
$this->original_content_type = isset( $_SERVER['CONTENT_TYPE'] ) ? $_SERVER['CONTENT_TYPE'] : null;
$this->original_http_accept = $_SERVER['HTTP_ACCEPT'] ?? null;
$this->original_content_type = $_SERVER['CONTENT_TYPE'] ?? null;
}

public function tear_down() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ public function set_up() {
parent::set_up();

foreach ( array( 'wp_scrape_key', 'wp_scrape_nonce' ) as $key ) {
$this->original_request[ $key ] = array_key_exists( $key, $_REQUEST ) ? $_REQUEST[ $key ] : null;
$this->original_request[ $key ] = $_REQUEST[ $key ] ?? null;
unset( $_REQUEST[ $key ] );
}
}
Expand Down
Loading