mirror of
https://github.com/gosticks/wordpress-develop.git
synced 2026-08-11 20:30:23 +00:00
Coding Standards: Fix a few newly introduced WPCS issues.
Follow-up to [56570], [56573], [56589], [56604], [56612], [56620], [56629], [56631], [56638], [56642], [56644], [56649]. Props jrf. See #59161, #58831. git-svn-id: https://develop.svn.wordpress.org/trunk@56680 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
@@ -41,16 +41,16 @@ class Tests_Admin_WpTermsListTable extends WP_UnitTestCase {
|
||||
/**
|
||||
* Call an inaccessible (private or protected) method.
|
||||
*
|
||||
* @param object|string $object Object instance or class string to call the method of.
|
||||
* @param object|string $instance Object instance or class string to call the method of.
|
||||
* @param string $method_name Name of the method to call.
|
||||
* @param array $args Optional. Array of arguments to pass to the method.
|
||||
* @return mixed Return value of the method call.
|
||||
* @throws ReflectionException If the object could not be reflected upon.
|
||||
*/
|
||||
private function call_inaccessible_method( $object, $method_name, $args = array() ) {
|
||||
$method = ( new ReflectionClass( $object ) )->getMethod( $method_name );
|
||||
private function call_inaccessible_method( $instance, $method_name, $args = array() ) {
|
||||
$method = ( new ReflectionClass( $instance ) )->getMethod( $method_name );
|
||||
$method->setAccessible( true );
|
||||
return $method->invokeArgs( $object, $args );
|
||||
return $method->invokeArgs( $instance, $args );
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -543,7 +543,6 @@ class Tests_Blocks_Editor extends WP_UnitTestCase {
|
||||
$settings = get_block_editor_settings( array(), $post_editor_context );
|
||||
|
||||
$this->assertArrayNotHasKey( 'postContentAttributes', $settings );
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -4436,7 +4436,7 @@ EOF;
|
||||
$result = null;
|
||||
add_filter(
|
||||
'the_content',
|
||||
function( $content ) use ( &$result ) {
|
||||
function ( $content ) use ( &$result ) {
|
||||
$attr = $this->get_width_height_for_high_priority();
|
||||
$result = wp_get_loading_optimization_attributes( 'img', $attr, 'something_completely_arbitrary' );
|
||||
return $content;
|
||||
@@ -4496,7 +4496,7 @@ EOF;
|
||||
|
||||
add_filter(
|
||||
'wp_loading_optimization_force_header_contexts',
|
||||
function( $context ) {
|
||||
function ( $context ) {
|
||||
$contexts['something_completely_arbitrary'] = true;
|
||||
return $contexts;
|
||||
}
|
||||
|
||||
@@ -34,7 +34,7 @@ class Tests_Vars extends WP_UnitTestCase {
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
function get_data_to_test_wp_is_mobile(): array {
|
||||
public function get_data_to_test_wp_is_mobile(): array {
|
||||
return array(
|
||||
'mobile client hint' => array(
|
||||
'headers' => array(
|
||||
@@ -104,8 +104,6 @@ class Tests_Vars extends WP_UnitTestCase {
|
||||
}
|
||||
|
||||
/**
|
||||
* Tests that wp_is_mobile() .
|
||||
*
|
||||
* @ticket 59370
|
||||
*
|
||||
* @covers ::wp_is_mobile
|
||||
@@ -115,7 +113,7 @@ class Tests_Vars extends WP_UnitTestCase {
|
||||
* @param array $headers Headers in $_SERVER.
|
||||
* @param bool $expected Whether expected.
|
||||
*/
|
||||
function test_wp_is_mobile( array $headers, bool $expected ) {
|
||||
public function test_wp_is_mobile( array $headers, bool $expected ) {
|
||||
foreach ( $headers as $key => $value ) {
|
||||
$_SERVER[ $key ] = $value;
|
||||
}
|
||||
@@ -127,7 +125,7 @@ class Tests_Vars extends WP_UnitTestCase {
|
||||
*
|
||||
* @covers ::wp_is_mobile
|
||||
*/
|
||||
function test_wp_is_mobile_is_true_with_filter() {
|
||||
public function test_wp_is_mobile_is_true_with_filter() {
|
||||
$this->assertFalse( wp_is_mobile() );
|
||||
add_filter( 'wp_is_mobile', '__return_true' );
|
||||
$this->assertTrue( wp_is_mobile() );
|
||||
@@ -138,7 +136,7 @@ class Tests_Vars extends WP_UnitTestCase {
|
||||
*
|
||||
* @covers ::wp_is_mobile
|
||||
*/
|
||||
function test_wp_is_mobile_is_false_with_filter() {
|
||||
public function test_wp_is_mobile_is_false_with_filter() {
|
||||
$_SERVER['HTTP_USER_AGENT'] = 'Mozilla/5.0 (Linux; Android 10) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/117.0.5938.60 Mobile Safari/537.36';
|
||||
$this->assertTrue( wp_is_mobile() );
|
||||
add_filter( 'wp_is_mobile', '__return_false' );
|
||||
|
||||
Reference in New Issue
Block a user