mirror of
git://develop.git.wordpress.org/
synced 2025-04-25 14:41:56 +02:00
Tests: Add tests to ensure that the WP_Network::$blog_id
property is a string.
Follow-up to [34097], [36340], [37657], [37870], [37871], [59020]. Fixes #62035. git-svn-id: https://develop.svn.wordpress.org/trunk@59021 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
parent
be75ea8e73
commit
dc60d05e4d
@ -126,6 +126,8 @@ if ( is_multisite() ) :
|
||||
}
|
||||
|
||||
/**
|
||||
* Tests that the `WP_Network::$id` property is an integer.
|
||||
*
|
||||
* @ticket 37050
|
||||
*
|
||||
* @covers WP_Network::__get
|
||||
@ -139,10 +141,10 @@ if ( is_multisite() ) :
|
||||
}
|
||||
|
||||
/**
|
||||
* Tests that the `WP_Network::$id` property is stored as int.
|
||||
* Tests that the `WP_Network::$id` property is stored as an integer.
|
||||
*
|
||||
* Uses reflection to access the private property.
|
||||
* Differs from using the public getter method, which casts to int.
|
||||
* Differs from using the public getter method, which casts to an integer.
|
||||
*
|
||||
* @ticket 62035
|
||||
*
|
||||
@ -160,6 +162,43 @@ if ( is_multisite() ) :
|
||||
$this->assertSame( (int) $id, $property->getValue( $network ) );
|
||||
}
|
||||
|
||||
/**
|
||||
* Tests that the `WP_Network::$blog_id` property is a string.
|
||||
*
|
||||
* @ticket 62035
|
||||
*
|
||||
* @covers WP_Network::__get
|
||||
*/
|
||||
public function test_wp_network_object_blog_id_property_is_int() {
|
||||
$id = self::factory()->network->create();
|
||||
|
||||
$network = WP_Network::get_instance( $id );
|
||||
|
||||
$this->assertIsString( $network->blog_id );
|
||||
}
|
||||
|
||||
/**
|
||||
* Tests that the `WP_Network::$blog_id` property is stored as a string.
|
||||
*
|
||||
* Uses reflection to access the private property.
|
||||
* Differs from using the public getter method, which casts to a string.
|
||||
*
|
||||
* @ticket 62035
|
||||
*
|
||||
* @covers WP_Network::__construct
|
||||
*/
|
||||
public function test_wp_network_object_blog_id_property_stored_as_string() {
|
||||
$id = self::factory()->network->create();
|
||||
|
||||
$network = WP_Network::get_instance( $id );
|
||||
|
||||
$reflection = new ReflectionObject( $network );
|
||||
$property = $reflection->getProperty( 'blog_id' );
|
||||
$property->setAccessible( true );
|
||||
|
||||
$this->assertIsString( $property->getValue( $network ) );
|
||||
}
|
||||
|
||||
/**
|
||||
* @ticket 22917
|
||||
*/
|
||||
|
Loading…
x
Reference in New Issue
Block a user