From 319818a40866a4fddffbfa0fc8b95c6eebf5f5ea Mon Sep 17 00:00:00 2001 From: Jeremy Felt Date: Fri, 2 Oct 2015 02:05:23 +0000 Subject: [PATCH] Tests: Clarify site option tests storing and retrieving serialized data. See #28290. git-svn-id: https://develop.svn.wordpress.org/trunk@34759 602fd350-edb4-49c9-b593-d223f7449a82 --- tests/phpunit/tests/option/siteOption.php | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/tests/phpunit/tests/option/siteOption.php b/tests/phpunit/tests/option/siteOption.php index 1562bf7674..d7dc1ce27a 100644 --- a/tests/phpunit/tests/option/siteOption.php +++ b/tests/phpunit/tests/option/siteOption.php @@ -114,17 +114,20 @@ class Tests_Option_SiteOption extends WP_UnitTestCase { $this->assertFalse( delete_site_option( $key ) ); } - function test_serialized_data() { + function test_site_option_add_and_get_serialized_array() { $key = rand_str(); $value = array( 'foo' => true, 'bar' => true ); - - $this->assertTrue( add_site_option( $key, $value ) ); + add_site_option( $key, $value ); $this->assertEquals( $value, get_site_option( $key ) ); + } - $value = (object) $value; - $this->assertTrue( update_site_option( $key, $value ) ); + function test_site_option_add_and_get_serialized_object() { + $key = rand_str(); + $value = new stdClass(); + $value->foo = true; + $value->bar = true; + add_site_option( $key, $value ); $this->assertEquals( $value, get_site_option( $key ) ); - $this->assertTrue( delete_site_option( $key ) ); } // #15497 - ensure update_site_option will add options with false-y values