Build/Test Tools: Remove some more randomness.

See #37371


git-svn-id: https://develop.svn.wordpress.org/trunk@39556 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
John Blackbourn 2016-12-10 00:01:30 +00:00
parent 6db50cd8b2
commit d9ac66c910
5 changed files with 42 additions and 42 deletions

View File

@ -271,9 +271,9 @@ abstract class WP_Test_REST_Post_Type_Controller_Testcase extends WP_Test_REST_C
protected function set_post_data( $args = array() ) {
$defaults = array(
'title' => rand_str(),
'content' => rand_str(),
'excerpt' => rand_str(),
'title' => 'Post Title',
'content' => 'Post content',
'excerpt' => 'Post excerpt',
'name' => 'test',
'status' => 'publish',
'author' => get_current_user_id(),
@ -286,13 +286,13 @@ abstract class WP_Test_REST_Post_Type_Controller_Testcase extends WP_Test_REST_C
protected function set_raw_post_data( $args = array() ) {
return wp_parse_args( $args, $this->set_post_data( array(
'title' => array(
'raw' => rand_str(),
'raw' => 'Post Title',
),
'content' => array(
'raw' => rand_str(),
'raw' => 'Post content',
),
'excerpt' => array(
'raw' => rand_str(),
'raw' => 'Post excerpt',
),
) ) );
}

View File

@ -17,8 +17,8 @@ class Tests_Option_NetworkOption extends WP_UnitTestCase {
}
$id = self::factory()->network->create();
$option = rand_str();
$value = rand_str();
$option = __FUNCTION__;
$value = __FUNCTION__;
add_site_option( $option, $value );
$this->assertFalse( get_network_option( $id, $option, false ) );
@ -30,8 +30,8 @@ class Tests_Option_NetworkOption extends WP_UnitTestCase {
}
$id = self::factory()->network->create();
$option = rand_str();
$value = rand_str();
$option = __FUNCTION__;
$value = __FUNCTION__;
add_network_option( $id, $option, $value );
$this->assertEquals( $value, get_network_option( $id, $option, false ) );
@ -43,8 +43,8 @@ class Tests_Option_NetworkOption extends WP_UnitTestCase {
}
$id = self::factory()->network->create();
$option = rand_str();
$value = rand_str();
$option = __FUNCTION__;
$value = __FUNCTION__;
add_site_option( $option, $value );
add_network_option( $id, $option, $value );
@ -56,7 +56,7 @@ class Tests_Option_NetworkOption extends WP_UnitTestCase {
* @ticket 22846
*/
public function test_add_network_option_is_not_stored_as_autoload_option() {
$key = rand_str();
$key = __FUNCTION__;
if ( is_multisite() ) {
$this->markTestSkipped( 'Does not apply when used in multisite.' );
@ -73,7 +73,7 @@ class Tests_Option_NetworkOption extends WP_UnitTestCase {
* @ticket 22846
*/
public function test_update_network_option_is_not_stored_as_autoload_option() {
$key = rand_str();
$key = __FUNCTION__;
if ( is_multisite() ) {
$this->markTestSkipped( 'Does not apply when used in multisite.' );

View File

@ -72,7 +72,7 @@ class Tests_Option_Option extends WP_UnitTestCase {
}
function test_serialized_data() {
$key = rand_str();
$key = __FUNCTION__;
$value = array( 'foo' => true, 'bar' => true );
$this->assertTrue( add_option( $key, $value ) );

View File

@ -13,24 +13,24 @@ class Tests_Option_SiteOption extends WP_UnitTestCase {
}
function test_get_site_option_returns_false_after_deletion() {
$key = rand_str();
$value = rand_str();
$key = __FUNCTION__;
$value = __FUNCTION__;
add_site_option( $key, $value );
delete_site_option( $key );
$this->assertFalse( get_site_option( $key ) );
}
function test_get_site_option_returns_value() {
$key = rand_str();
$value = rand_str();
$key = __FUNCTION__;
$value = __FUNCTION__;
add_site_option( $key, $value );
$this->assertEquals( $value, get_site_option( $key ) );
}
function test_get_site_option_returns_updated_value() {
$key = rand_str();
$value = rand_str();
$new_value = rand_str();
$key = __FUNCTION__;
$value = __FUNCTION__ . '_1';
$new_value = __FUNCTION__ . '_2';
add_site_option( $key, $value );
update_site_option( $key, $new_value );
$this->assertEquals( $new_value, get_site_option( $key ) );
@ -55,15 +55,15 @@ class Tests_Option_SiteOption extends WP_UnitTestCase {
}
function test_get_site_option_exists_does_not_return_provided_default() {
$key = rand_str();
$value = rand_str();
$key = __FUNCTION__;
$value = __FUNCTION__;
add_site_option( $key, $value );
$this->assertEquals( $value, get_site_option( $key, 'foo' ) );
}
function test_get_site_option_exists_does_not_return_filtered_default() {
$key = rand_str();
$value = rand_str();
$key = __FUNCTION__;
$value = __FUNCTION__;
add_site_option( $key, $value );
add_filter( 'default_site_option_' . $key , array( $this, '__return_foo' ) );
$site_option = get_site_option( $key );
@ -72,21 +72,21 @@ class Tests_Option_SiteOption extends WP_UnitTestCase {
}
function test_add_site_option_returns_true_for_new_option() {
$key = rand_str();
$value = rand_str();
$key = __FUNCTION__;
$value = __FUNCTION__;
$this->assertTrue( add_site_option( $key, $value ) );
}
function test_add_site_option_returns_false_for_existing_option() {
$key = rand_str();
$value = rand_str();
$key = __FUNCTION__;
$value = __FUNCTION__;
add_site_option( $key, $value );
$this->assertFalse( add_site_option( $key, $value ) );
}
function test_update_site_option_returns_false_for_same_value() {
$key = rand_str();
$value = rand_str();
$key = __FUNCTION__;
$value = __FUNCTION__;
add_site_option( $key, $value );
$this->assertFalse( update_site_option( $key, $value ) );
}
@ -100,29 +100,29 @@ class Tests_Option_SiteOption extends WP_UnitTestCase {
}
function test_delete_site_option_returns_true_if_option_exists() {
$key = rand_str();
$value = rand_str();
$key = __FUNCTION__;
$value = __FUNCTION__;
add_site_option( $key, $value );
$this->assertTrue( delete_site_option( $key ) );
}
function test_delete_site_option_returns_false_if_option_does_not_exist() {
$key = rand_str();
$value = rand_str();
$key = __FUNCTION__;
$value = __FUNCTION__;
add_site_option( $key, $value );
delete_site_option( $key );
$this->assertFalse( delete_site_option( $key ) );
}
function test_site_option_add_and_get_serialized_array() {
$key = rand_str();
$key = __FUNCTION__;
$value = array( 'foo' => true, 'bar' => true );
add_site_option( $key, $value );
$this->assertEquals( $value, get_site_option( $key ) );
}
function test_site_option_add_and_get_serialized_object() {
$key = rand_str();
$key = __FUNCTION__;
$value = new stdClass();
$value->foo = true;
$value->bar = true;
@ -132,7 +132,7 @@ class Tests_Option_SiteOption extends WP_UnitTestCase {
// #15497 - ensure update_site_option will add options with false-y values
function test_update_adds_falsey_value() {
$key = rand_str();
$key = __FUNCTION__;
$value = 0;
delete_site_option( $key );
@ -143,7 +143,7 @@ class Tests_Option_SiteOption extends WP_UnitTestCase {
// #18955 - ensure get_site_option doesn't cache the default value for non-existent options
function test_get_doesnt_cache_default_value() {
$option = rand_str();
$option = __FUNCTION__;
$default = 'a default';
$this->assertEquals( get_site_option( $option, $default ), $default );

View File

@ -30,7 +30,7 @@ class Tests_Option_SiteTransient extends WP_UnitTestCase {
}
function test_serialized_data() {
$key = rand_str();
$key = __FUNCTION__;
$value = array( 'foo' => true, 'bar' => true );
$this->assertTrue( set_site_transient( $key, $value ) );
@ -46,7 +46,7 @@ class Tests_Option_SiteTransient extends WP_UnitTestCase {
* @ticket 22846
*/
public function test_set_site_transient_is_not_stored_as_autoload_option() {
$key = rand_str();
$key = 'not_autoloaded';
if ( is_multisite() ) {
$this->markTestSkipped( 'Does not apply when used in multisite.' );