Update the tests for `get_metadata()` to reflect the revert in r30701.

See #15030


git-svn-id: https://develop.svn.wordpress.org/trunk@30702 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
John Blackbourn 2014-12-02 03:43:17 +00:00
parent 294b608879
commit 5cda7d6aed
1 changed files with 9 additions and 6 deletions

View File

@ -295,38 +295,41 @@ class Tests_Meta extends WP_UnitTestCase {
/**
* @ticket 15030
*/
public function test_get_metadata_with_empty_key_array_value_should_be_unserialized() {
public function test_get_metadata_with_empty_key_array_value() {
$data = array( 1, 2 );
$value = serialize( $data );
add_metadata( 'user', $this->author->ID, 'foo', $data );
$found = get_metadata( 'user', $this->author->ID );
$this->assertSame( array( $data ), $found['foo'] );
$this->assertSame( array( $value ), $found['foo'] );
}
/**
* @ticket 15030
*/
public function test_get_metadata_with_empty_key_object_value_should_be_unserialized() {
public function test_get_metadata_with_empty_key_object_value() {
$data = new stdClass;
$data->foo = 'bar';
$value = serialize( $data );
add_metadata( 'user', $this->author->ID, 'foo', $data );
$found = get_metadata( 'user', $this->author->ID );
$this->assertEquals( array( $data ), $found['foo'] );
$this->assertEquals( array( $value ), $found['foo'] );
}
/**
* @ticket 15030
*/
public function test_get_metadata_with_empty_key_nested_array_value_should_be_unserialized() {
public function test_get_metadata_with_empty_key_nested_array_value() {
$data = array(
array( 1, 2 ),
array( 3, 4 ),
);
$value = serialize( $data );
add_metadata( 'user', $this->author->ID, 'foo', $data );
$found = get_metadata( 'user', $this->author->ID );
$this->assertSame( array( $data ), $found['foo'] );
$this->assertSame( array( $value ), $found['foo'] );
}
/** Helpers **********************************************************/