mirror of
https://github.com/gosticks/wordpress-develop.git
synced 2026-07-10 04:00:07 +00:00
Tests: Remove some unnecessary function_exists() checks for compat functions.
Each of these functions already has a separate test for availability. If any of them are unavailable, then the test should fail rather than be skipped. Follow-up to [52038], [52039], [52040]. Props johnbillion. See #59647. git-svn-id: https://develop.svn.wordpress.org/trunk@56969 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
@@ -24,14 +24,7 @@ class Tests_Compat_arrayKeyFirst extends WP_UnitTestCase {
|
||||
* @param array $arr The array to get first key from.
|
||||
*/
|
||||
public function test_array_key_first( $expected, $arr ) {
|
||||
if ( ! function_exists( 'array_key_first' ) ) {
|
||||
$this->markTestSkipped( 'array_key_first() is not available.' );
|
||||
} else {
|
||||
$this->assertSame(
|
||||
$expected,
|
||||
array_key_first( $arr )
|
||||
);
|
||||
}
|
||||
$this->assertSame( $expected, array_key_first( $arr ) );
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -25,11 +25,7 @@ class Tests_Compat_ArrayKeyLast extends WP_UnitTestCase {
|
||||
* @param array $arr The array to get last key from.
|
||||
*/
|
||||
public function test_array_key_last( $expected, $arr ) {
|
||||
if ( ! function_exists( 'array_key_last' ) ) {
|
||||
$this->markTestSkipped( 'array_key_last() is not available.' );
|
||||
} else {
|
||||
$this->assertSame( $expected, array_key_last( $arr ) );
|
||||
}
|
||||
$this->assertSame( $expected, array_key_last( $arr ) );
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -26,14 +26,7 @@ class Tests_Compat_strContains extends WP_UnitTestCase {
|
||||
* @param string $needle The substring to search for in `$haystack`.
|
||||
*/
|
||||
public function test_str_contains( $expected, $haystack, $needle ) {
|
||||
if ( ! function_exists( 'str_contains' ) ) {
|
||||
$this->markTestSkipped( 'str_contains() is not available.' );
|
||||
} else {
|
||||
$this->assertSame(
|
||||
$expected,
|
||||
str_contains( $haystack, $needle )
|
||||
);
|
||||
}
|
||||
$this->assertSame( $expected, str_contains( $haystack, $needle ) );
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -26,14 +26,7 @@ class Tests_Compat_StrEndsWith extends WP_UnitTestCase {
|
||||
* @param string $needle The substring to search for at the end of `$haystack`.
|
||||
*/
|
||||
public function test_str_ends_with( $expected, $haystack, $needle ) {
|
||||
if ( ! function_exists( 'str_ends_with' ) ) {
|
||||
$this->markTestSkipped( 'str_ends_with() is not available.' );
|
||||
} else {
|
||||
$this->assertSame(
|
||||
$expected,
|
||||
str_ends_with( $haystack, $needle )
|
||||
);
|
||||
}
|
||||
$this->assertSame( $expected, str_ends_with( $haystack, $needle ) );
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -26,14 +26,7 @@ class Tests_Compat_StrStartsWith extends WP_UnitTestCase {
|
||||
* @param string $needle The substring to search for at the start of `$haystack`.
|
||||
*/
|
||||
public function test_str_starts_with( $expected, $haystack, $needle ) {
|
||||
if ( ! function_exists( 'str_starts_with' ) ) {
|
||||
$this->markTestSkipped( 'str_starts_with() is not available.' );
|
||||
} else {
|
||||
$this->assertSame(
|
||||
$expected,
|
||||
str_starts_with( $haystack, $needle )
|
||||
);
|
||||
}
|
||||
$this->assertSame( $expected, str_starts_with( $haystack, $needle ) );
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user