Skip to content

Commit 319818a

Browse files
committed
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
1 parent b9e1b4a commit 319818a

1 file changed

Lines changed: 9 additions & 6 deletions

File tree

tests/phpunit/tests/option/siteOption.php

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -114,17 +114,20 @@ function test_delete_site_option_returns_false_if_option_does_not_exist() {
114114
$this->assertFalse( delete_site_option( $key ) );
115115
}
116116

117-
function test_serialized_data() {
117+
function test_site_option_add_and_get_serialized_array() {
118118
$key = rand_str();
119119
$value = array( 'foo' => true, 'bar' => true );
120-
121-
$this->assertTrue( add_site_option( $key, $value ) );
120+
add_site_option( $key, $value );
122121
$this->assertEquals( $value, get_site_option( $key ) );
122+
}
123123

124-
$value = (object) $value;
125-
$this->assertTrue( update_site_option( $key, $value ) );
124+
function test_site_option_add_and_get_serialized_object() {
125+
$key = rand_str();
126+
$value = new stdClass();
127+
$value->foo = true;
128+
$value->bar = true;
129+
add_site_option( $key, $value );
126130
$this->assertEquals( $value, get_site_option( $key ) );
127-
$this->assertTrue( delete_site_option( $key ) );
128131
}
129132

130133
// #15497 - ensure update_site_option will add options with false-y values

0 commit comments

Comments
 (0)