mirror of
https://github.com/gosticks/wordpress-develop.git
synced 2026-10-04 06:37:06 +00:00
Tests: Use more appropriate assertions in various tests.
This replaces instances of `assertTrue( isset( ... ) )` with `assertArrayHasKey()` to use native PHPUnit functionality. Follow-up to [51335], [51337], [51367]. See #53363. git-svn-id: https://develop.svn.wordpress.org/trunk@51397 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
@@ -237,7 +237,7 @@ class Tests_REST_API extends WP_UnitTestCase {
|
||||
true
|
||||
);
|
||||
$endpoints = $GLOBALS['wp_rest_server']->get_routes();
|
||||
$this->assertFalse( isset( $endpoints['/test-empty-namespace'] ) );
|
||||
$this->assertArrayNotHasKey( '/test-empty-namespace', $endpoints );
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -257,7 +257,7 @@ class Tests_REST_API extends WP_UnitTestCase {
|
||||
true
|
||||
);
|
||||
$endpoints = $GLOBALS['wp_rest_server']->get_routes();
|
||||
$this->assertFalse( isset( $endpoints['/test-empty-route'] ) );
|
||||
$this->assertArrayNotHasKey( '/test-empty-route', $endpoints );
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -951,7 +951,7 @@ class Tests_REST_API extends WP_UnitTestCase {
|
||||
);
|
||||
|
||||
$this->assertSame( array_keys( $preload_data ), array( '/wp/v2/types', 'OPTIONS' ) );
|
||||
$this->assertTrue( isset( $preload_data['OPTIONS']['/wp/v2/media'] ) );
|
||||
$this->assertArrayHasKey( '/wp/v2/media', $preload_data['OPTIONS'] );
|
||||
|
||||
$GLOBALS['wp_rest_server'] = $rest_server;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user