mirror of
https://github.com/gosticks/wordpress-develop.git
synced 2025-10-16 12:05:38 +00:00
Build/Test Tools: Reduce the use of unnecessary randomness in tests.
This increases the overall reliability of the tests. Props johnillo Fixes #37371 git-svn-id: https://develop.svn.wordpress.org/trunk@52389 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
parent
77757441a4
commit
029bea45b0
@ -240,8 +240,8 @@ class Tests_Actions extends WP_UnitTestCase {
|
||||
$this->assertSame( 1, did_action( $tag1 ) );
|
||||
$this->assertSame( 0, did_action( $tag2 ) );
|
||||
|
||||
// Do action $tag2 a random number of times.
|
||||
$count = rand( 0, 10 );
|
||||
// Do action $tag2 10 times.
|
||||
$count = 10;
|
||||
for ( $i = 0; $i < $count; $i++ ) {
|
||||
do_action( $tag2 );
|
||||
}
|
||||
|
||||
@ -487,11 +487,12 @@ class Tests_Admin_IncludesPlugin extends WP_UnitTestCase {
|
||||
$p2 = $this->_create_plugin( "<?php\n//Test", 'not-a-dropin.php', WP_CONTENT_DIR );
|
||||
|
||||
$dropins = get_dropins();
|
||||
$this->assertSame( array( 'advanced-cache.php' ), array_keys( $dropins ) );
|
||||
|
||||
unlink( $p1[1] );
|
||||
unlink( $p2[1] );
|
||||
|
||||
$this->assertSame( array( 'advanced-cache.php' ), array_keys( $dropins ) );
|
||||
|
||||
// Clean up.
|
||||
$this->_restore_drop_ins();
|
||||
}
|
||||
@ -509,9 +510,11 @@ class Tests_Admin_IncludesPlugin extends WP_UnitTestCase {
|
||||
public function test_is_network_only_plugin() {
|
||||
$p = $this->_create_plugin( "<?php\n/*\nPlugin Name: test\nNetwork: true" );
|
||||
|
||||
$this->assertTrue( is_network_only_plugin( $p[0] ) );
|
||||
$network_only = is_network_only_plugin( $p[0] );
|
||||
|
||||
unlink( $p[1] );
|
||||
|
||||
$this->assertTrue( $network_only );
|
||||
}
|
||||
|
||||
/**
|
||||
@ -571,12 +574,14 @@ class Tests_Admin_IncludesPlugin extends WP_UnitTestCase {
|
||||
$uninstallable_plugins[ $plugin[0] ] = true;
|
||||
update_option( 'uninstall_plugins', $uninstallable_plugins );
|
||||
|
||||
$this->assertTrue( is_uninstallable_plugin( $plugin[0] ) );
|
||||
$is_uninstallable = is_uninstallable_plugin( $plugin[0] );
|
||||
|
||||
unset( $uninstallable_plugins[ $plugin[0] ] );
|
||||
update_option( 'uninstall_plugins', $uninstallable_plugins );
|
||||
|
||||
unlink( $plugin[1] );
|
||||
|
||||
$this->assertTrue( $is_uninstallable );
|
||||
}
|
||||
|
||||
/**
|
||||
@ -595,14 +600,15 @@ class Tests_Admin_IncludesPlugin extends WP_UnitTestCase {
|
||||
*/
|
||||
private function _create_plugin( $data = "<?php\n/*\nPlugin Name: Test\n*/", $filename = false, $dir_path = false ) {
|
||||
if ( false === $filename ) {
|
||||
$filename = rand_str() . '.php';
|
||||
$filename = __FUNCTION__ . '.php';
|
||||
}
|
||||
|
||||
if ( false === $dir_path ) {
|
||||
$dir_path = WP_PLUGIN_DIR;
|
||||
}
|
||||
|
||||
$full_name = $dir_path . '/' . wp_unique_filename( $dir_path, $filename );
|
||||
$filename = wp_unique_filename( $dir_path, $filename );
|
||||
$full_name = $dir_path . '/' . $filename;
|
||||
|
||||
$file = fopen( $full_name, 'w' );
|
||||
fwrite( $file, $data );
|
||||
|
||||
@ -270,7 +270,7 @@ class Tests_Cron extends WP_UnitTestCase {
|
||||
*/
|
||||
public function test_unschedule_hook() {
|
||||
$hook = __FUNCTION__;
|
||||
$args = array( rand_str() );
|
||||
$args = array( 'foo' );
|
||||
|
||||
// Schedule several events with and without arguments.
|
||||
wp_schedule_single_event( strtotime( '+1 hour' ), $hook );
|
||||
|
||||
@ -228,7 +228,7 @@ class Tests_Date_XMLRPC extends WP_XMLRPC_UnitTestCase {
|
||||
'comment_author' => 'Test commenter',
|
||||
'comment_author_url' => 'http://example.com/',
|
||||
'comment_author_email' => 'example@example.com',
|
||||
'comment_content' => rand_str( 100 ),
|
||||
'comment_content' => 'Hello, world!',
|
||||
'comment_approved' => '1',
|
||||
);
|
||||
$comment_id = wp_insert_comment( $comment_data );
|
||||
|
||||
@ -96,8 +96,8 @@ class Tests_File extends WP_UnitTestCase {
|
||||
return false;
|
||||
}
|
||||
|
||||
// Write some random contents.
|
||||
$c = rand_str();
|
||||
// Write some contents.
|
||||
$c = 'foo';
|
||||
fwrite( $fp, $c );
|
||||
fclose( $fp );
|
||||
|
||||
|
||||
@ -15,8 +15,8 @@ class Tests_Hooks_AddFilter extends WP_UnitTestCase {
|
||||
$callback = '__return_null';
|
||||
$hook = new WP_Hook();
|
||||
$tag = __FUNCTION__;
|
||||
$priority = rand( 1, 100 );
|
||||
$accepted_args = rand( 1, 100 );
|
||||
$priority = 1;
|
||||
$accepted_args = 2;
|
||||
|
||||
$hook->add_filter( $tag, $callback, $priority, $accepted_args );
|
||||
|
||||
@ -30,8 +30,8 @@ class Tests_Hooks_AddFilter extends WP_UnitTestCase {
|
||||
$callback = array( $a, 'action' );
|
||||
$hook = new WP_Hook();
|
||||
$tag = __FUNCTION__;
|
||||
$priority = rand( 1, 100 );
|
||||
$accepted_args = rand( 1, 100 );
|
||||
$priority = 1;
|
||||
$accepted_args = 2;
|
||||
|
||||
$hook->add_filter( $tag, $callback, $priority, $accepted_args );
|
||||
|
||||
@ -44,8 +44,8 @@ class Tests_Hooks_AddFilter extends WP_UnitTestCase {
|
||||
$callback = array( 'MockAction', 'action' );
|
||||
$hook = new WP_Hook();
|
||||
$tag = __FUNCTION__;
|
||||
$priority = rand( 1, 100 );
|
||||
$accepted_args = rand( 1, 100 );
|
||||
$priority = 1;
|
||||
$accepted_args = 2;
|
||||
|
||||
$hook->add_filter( $tag, $callback, $priority, $accepted_args );
|
||||
|
||||
@ -59,8 +59,8 @@ class Tests_Hooks_AddFilter extends WP_UnitTestCase {
|
||||
$callback_two = '__return_false';
|
||||
$hook = new WP_Hook();
|
||||
$tag = __FUNCTION__;
|
||||
$priority = rand( 1, 100 );
|
||||
$accepted_args = rand( 1, 100 );
|
||||
$priority = 1;
|
||||
$accepted_args = 2;
|
||||
|
||||
$hook->add_filter( $tag, $callback_one, $priority, $accepted_args );
|
||||
$this->assertCount( 1, $hook->callbacks[ $priority ] );
|
||||
@ -74,8 +74,8 @@ class Tests_Hooks_AddFilter extends WP_UnitTestCase {
|
||||
$callback_two = '__return_false';
|
||||
$hook = new WP_Hook();
|
||||
$tag = __FUNCTION__;
|
||||
$priority = rand( 1, 100 );
|
||||
$accepted_args = rand( 1, 100 );
|
||||
$priority = 1;
|
||||
$accepted_args = 2;
|
||||
|
||||
$hook->add_filter( $tag, $callback_one, $priority, $accepted_args );
|
||||
$this->assertCount( 1, $hook->callbacks[ $priority ] );
|
||||
@ -89,8 +89,8 @@ class Tests_Hooks_AddFilter extends WP_UnitTestCase {
|
||||
$callback = '__return_null';
|
||||
$hook = new WP_Hook();
|
||||
$tag = __FUNCTION__;
|
||||
$priority = rand( 1, 100 );
|
||||
$accepted_args = rand( 1, 100 );
|
||||
$priority = 1;
|
||||
$accepted_args = 2;
|
||||
|
||||
$hook->add_filter( $tag, $callback, $priority, $accepted_args );
|
||||
$this->assertCount( 1, $hook->callbacks[ $priority ] );
|
||||
@ -103,8 +103,8 @@ class Tests_Hooks_AddFilter extends WP_UnitTestCase {
|
||||
$callback = '__return_null';
|
||||
$hook = new WP_Hook();
|
||||
$tag = __FUNCTION__;
|
||||
$priority = rand( 1, 100 );
|
||||
$accepted_args = rand( 1, 100 );
|
||||
$priority = 1;
|
||||
$accepted_args = 2;
|
||||
|
||||
$hook->add_filter( $tag, $callback, $priority, $accepted_args );
|
||||
$this->assertCount( 1, $hook->callbacks[ $priority ] );
|
||||
|
||||
@ -13,8 +13,8 @@ class Tests_Hooks_ApplyFilters extends WP_UnitTestCase {
|
||||
$callback = array( $a, 'filter' );
|
||||
$hook = new WP_Hook();
|
||||
$tag = __FUNCTION__;
|
||||
$priority = rand( 1, 100 );
|
||||
$accepted_args = rand( 1, 100 );
|
||||
$priority = 1;
|
||||
$accepted_args = 2;
|
||||
$arg = __FUNCTION__ . '_arg';
|
||||
|
||||
$hook->add_filter( $tag, $callback, $priority, $accepted_args );
|
||||
@ -30,8 +30,8 @@ class Tests_Hooks_ApplyFilters extends WP_UnitTestCase {
|
||||
$callback = array( $a, 'filter' );
|
||||
$hook = new WP_Hook();
|
||||
$tag = __FUNCTION__;
|
||||
$priority = rand( 1, 100 );
|
||||
$accepted_args = rand( 1, 100 );
|
||||
$priority = 1;
|
||||
$accepted_args = 2;
|
||||
$arg = __FUNCTION__ . '_arg';
|
||||
|
||||
$hook->add_filter( $tag, $callback, $priority, $accepted_args );
|
||||
|
||||
@ -21,8 +21,8 @@ class Tests_Hooks_DoAction extends WP_UnitTestCase {
|
||||
$callback = array( $a, 'action' );
|
||||
$hook = new WP_Hook();
|
||||
$tag = __FUNCTION__;
|
||||
$priority = rand( 1, 100 );
|
||||
$accepted_args = rand( 1, 100 );
|
||||
$priority = 1;
|
||||
$accepted_args = 2;
|
||||
$arg = __FUNCTION__ . '_arg';
|
||||
|
||||
$hook->add_filter( $tag, $callback, $priority, $accepted_args );
|
||||
@ -36,8 +36,8 @@ class Tests_Hooks_DoAction extends WP_UnitTestCase {
|
||||
$callback = array( $a, 'filter' );
|
||||
$hook = new WP_Hook();
|
||||
$tag = __FUNCTION__;
|
||||
$priority = rand( 1, 100 );
|
||||
$accepted_args = rand( 1, 100 );
|
||||
$priority = 1;
|
||||
$accepted_args = 2;
|
||||
$arg = __FUNCTION__ . '_arg';
|
||||
|
||||
$hook->add_filter( $tag, $callback, $priority, $accepted_args );
|
||||
@ -54,8 +54,8 @@ class Tests_Hooks_DoAction extends WP_UnitTestCase {
|
||||
$callback_two = array( $b, 'filter' );
|
||||
$hook = new WP_Hook();
|
||||
$tag = __FUNCTION__;
|
||||
$priority = rand( 1, 100 );
|
||||
$accepted_args = rand( 1, 100 );
|
||||
$priority = 1;
|
||||
$accepted_args = 2;
|
||||
$arg = __FUNCTION__ . '_arg';
|
||||
|
||||
$hook->add_filter( $tag, $callback_one, $priority, $accepted_args );
|
||||
@ -73,8 +73,8 @@ class Tests_Hooks_DoAction extends WP_UnitTestCase {
|
||||
$callback_two = array( $b, 'filter' );
|
||||
$hook = new WP_Hook();
|
||||
$tag = __FUNCTION__;
|
||||
$priority = rand( 1, 100 );
|
||||
$accepted_args = rand( 1, 100 );
|
||||
$priority = 1;
|
||||
$accepted_args = 2;
|
||||
$arg = __FUNCTION__ . '_arg';
|
||||
|
||||
$hook->add_filter( $tag, $callback_one, $priority, $accepted_args );
|
||||
@ -89,7 +89,7 @@ class Tests_Hooks_DoAction extends WP_UnitTestCase {
|
||||
$callback = array( $this, '_action_callback' );
|
||||
$hook = new WP_Hook();
|
||||
$tag = __FUNCTION__;
|
||||
$priority = rand( 1, 100 );
|
||||
$priority = 1;
|
||||
$accepted_args = 0;
|
||||
$arg = __FUNCTION__ . '_arg';
|
||||
|
||||
@ -103,7 +103,7 @@ class Tests_Hooks_DoAction extends WP_UnitTestCase {
|
||||
$callback = array( $this, '_action_callback' );
|
||||
$hook = new WP_Hook();
|
||||
$tag = __FUNCTION__;
|
||||
$priority = rand( 1, 100 );
|
||||
$priority = 1;
|
||||
$accepted_args = 1;
|
||||
$arg = __FUNCTION__ . '_arg';
|
||||
|
||||
@ -117,7 +117,7 @@ class Tests_Hooks_DoAction extends WP_UnitTestCase {
|
||||
$callback = array( $this, '_action_callback' );
|
||||
$hook = new WP_Hook();
|
||||
$tag = __FUNCTION__;
|
||||
$priority = rand( 1, 100 );
|
||||
$priority = 100;
|
||||
$accepted_args = 1000;
|
||||
$arg = __FUNCTION__ . '_arg';
|
||||
|
||||
|
||||
@ -13,8 +13,8 @@ class Tests_Hooks_DoAllHook extends WP_UnitTestCase {
|
||||
$callback = array( $a, 'action' );
|
||||
$hook = new WP_Hook();
|
||||
$tag = 'all';
|
||||
$priority = rand( 1, 100 );
|
||||
$accepted_args = rand( 1, 100 );
|
||||
$priority = 1;
|
||||
$accepted_args = 2;
|
||||
$arg = 'all_arg';
|
||||
|
||||
$hook->add_filter( $tag, $callback, $priority, $accepted_args );
|
||||
|
||||
@ -12,8 +12,8 @@ class Tests_Hooks_HasFilter extends WP_UnitTestCase {
|
||||
$callback = '__return_null';
|
||||
$hook = new WP_Hook();
|
||||
$tag = __FUNCTION__;
|
||||
$priority = rand( 1, 100 );
|
||||
$accepted_args = rand( 1, 100 );
|
||||
$priority = 1;
|
||||
$accepted_args = 2;
|
||||
|
||||
$hook->add_filter( $tag, $callback, $priority, $accepted_args );
|
||||
|
||||
@ -25,8 +25,8 @@ class Tests_Hooks_HasFilter extends WP_UnitTestCase {
|
||||
$callback = array( $a, 'action' );
|
||||
$hook = new WP_Hook();
|
||||
$tag = __FUNCTION__;
|
||||
$priority = rand( 1, 100 );
|
||||
$accepted_args = rand( 1, 100 );
|
||||
$priority = 1;
|
||||
$accepted_args = 2;
|
||||
|
||||
$hook->add_filter( $tag, $callback, $priority, $accepted_args );
|
||||
|
||||
@ -37,8 +37,8 @@ class Tests_Hooks_HasFilter extends WP_UnitTestCase {
|
||||
$callback = array( 'MockAction', 'action' );
|
||||
$hook = new WP_Hook();
|
||||
$tag = __FUNCTION__;
|
||||
$priority = rand( 1, 100 );
|
||||
$accepted_args = rand( 1, 100 );
|
||||
$priority = 1;
|
||||
$accepted_args = 2;
|
||||
|
||||
$hook->add_filter( $tag, $callback, $priority, $accepted_args );
|
||||
|
||||
@ -49,8 +49,8 @@ class Tests_Hooks_HasFilter extends WP_UnitTestCase {
|
||||
$callback = '__return_null';
|
||||
$hook = new WP_Hook();
|
||||
$tag = __FUNCTION__;
|
||||
$priority = rand( 1, 100 );
|
||||
$accepted_args = rand( 1, 100 );
|
||||
$priority = 1;
|
||||
$accepted_args = 2;
|
||||
|
||||
$hook->add_filter( $tag, $callback, $priority, $accepted_args );
|
||||
|
||||
@ -74,8 +74,8 @@ class Tests_Hooks_HasFilter extends WP_UnitTestCase {
|
||||
$callback = '__return_null';
|
||||
$hook = new WP_Hook();
|
||||
$tag = __FUNCTION__;
|
||||
$priority = rand( 1, 100 );
|
||||
$accepted_args = rand( 1, 100 );
|
||||
$priority = 1;
|
||||
$accepted_args = 2;
|
||||
|
||||
$hook->add_filter( $tag, $callback, $priority, $accepted_args );
|
||||
|
||||
|
||||
@ -12,8 +12,8 @@ class Tests_Hooks_HasFilters extends WP_UnitTestCase {
|
||||
$callback = '__return_null';
|
||||
$hook = new WP_Hook();
|
||||
$tag = __FUNCTION__;
|
||||
$priority = rand( 1, 100 );
|
||||
$accepted_args = rand( 1, 100 );
|
||||
$priority = 1;
|
||||
$accepted_args = 2;
|
||||
|
||||
$hook->add_filter( $tag, $callback, $priority, $accepted_args );
|
||||
|
||||
@ -29,8 +29,8 @@ class Tests_Hooks_HasFilters extends WP_UnitTestCase {
|
||||
$callback = '__return_null';
|
||||
$hook = new WP_Hook();
|
||||
$tag = __FUNCTION__;
|
||||
$priority = rand( 1, 100 );
|
||||
$accepted_args = rand( 1, 100 );
|
||||
$priority = 1;
|
||||
$accepted_args = 2;
|
||||
|
||||
$hook->add_filter( $tag, $callback, $priority, $accepted_args );
|
||||
$hook->remove_filter( $tag, $callback, $priority );
|
||||
@ -41,8 +41,8 @@ class Tests_Hooks_HasFilters extends WP_UnitTestCase {
|
||||
$callback = '__return_null';
|
||||
$hook = new WP_Hook();
|
||||
$tag = __FUNCTION__;
|
||||
$priority = rand( 1, 100 );
|
||||
$accepted_args = rand( 1, 100 );
|
||||
$priority = 1;
|
||||
$accepted_args = 2;
|
||||
|
||||
$hook->add_filter( $tag, $callback, $priority, $accepted_args );
|
||||
$function_key = _wp_filter_build_unique_id( $tag, $callback, $priority );
|
||||
|
||||
@ -13,8 +13,8 @@ class Tests_Hooks_Iterator extends WP_UnitTestCase {
|
||||
$callback_two = '__return_false';
|
||||
$hook = new WP_Hook();
|
||||
$tag = __FUNCTION__;
|
||||
$priority = rand( 1, 100 );
|
||||
$accepted_args = rand( 1, 100 );
|
||||
$priority = 1;
|
||||
$accepted_args = 2;
|
||||
|
||||
$hook->add_filter( $tag, $callback_one, $priority, $accepted_args );
|
||||
$hook->add_filter( $tag, $callback_two, $priority + 1, $accepted_args );
|
||||
|
||||
@ -10,9 +10,9 @@ class Tests_Hooks_PreinitHooks extends WP_UnitTestCase {
|
||||
|
||||
public function test_array_to_hooks() {
|
||||
$tag1 = __FUNCTION__ . '_1';
|
||||
$priority1 = rand( 1, 100 );
|
||||
$priority1 = 1;
|
||||
$tag2 = __FUNCTION__ . '_2';
|
||||
$priority2 = rand( 1, 100 );
|
||||
$priority2 = 2;
|
||||
$filters = array(
|
||||
$tag1 => array(
|
||||
$priority1 => array(
|
||||
|
||||
@ -12,8 +12,8 @@ class Tests_Hooks_RemoveAllFilters extends WP_UnitTestCase {
|
||||
$callback = '__return_null';
|
||||
$hook = new WP_Hook();
|
||||
$tag = __FUNCTION__;
|
||||
$priority = rand( 1, 100 );
|
||||
$accepted_args = rand( 1, 100 );
|
||||
$priority = 1;
|
||||
$accepted_args = 2;
|
||||
|
||||
$hook->add_filter( $tag, $callback, $priority, $accepted_args );
|
||||
|
||||
@ -27,8 +27,8 @@ class Tests_Hooks_RemoveAllFilters extends WP_UnitTestCase {
|
||||
$callback_two = '__return_false';
|
||||
$hook = new WP_Hook();
|
||||
$tag = __FUNCTION__;
|
||||
$priority = rand( 1, 100 );
|
||||
$accepted_args = rand( 1, 100 );
|
||||
$priority = 1;
|
||||
$accepted_args = 2;
|
||||
|
||||
$hook->add_filter( $tag, $callback_one, $priority, $accepted_args );
|
||||
$hook->add_filter( $tag, $callback_two, $priority + 1, $accepted_args );
|
||||
|
||||
@ -12,8 +12,8 @@ class Tests_Hooks_RemoveFilter extends WP_UnitTestCase {
|
||||
$callback = '__return_null';
|
||||
$hook = new WP_Hook();
|
||||
$tag = __FUNCTION__;
|
||||
$priority = rand( 1, 100 );
|
||||
$accepted_args = rand( 1, 100 );
|
||||
$priority = 1;
|
||||
$accepted_args = 2;
|
||||
|
||||
$hook->add_filter( $tag, $callback, $priority, $accepted_args );
|
||||
$hook->remove_filter( $tag, $callback, $priority );
|
||||
@ -26,8 +26,8 @@ class Tests_Hooks_RemoveFilter extends WP_UnitTestCase {
|
||||
$callback = array( $a, 'action' );
|
||||
$hook = new WP_Hook();
|
||||
$tag = __FUNCTION__;
|
||||
$priority = rand( 1, 100 );
|
||||
$accepted_args = rand( 1, 100 );
|
||||
$priority = 1;
|
||||
$accepted_args = 2;
|
||||
|
||||
$hook->add_filter( $tag, $callback, $priority, $accepted_args );
|
||||
$hook->remove_filter( $tag, $callback, $priority );
|
||||
@ -39,8 +39,8 @@ class Tests_Hooks_RemoveFilter extends WP_UnitTestCase {
|
||||
$callback = array( 'MockAction', 'action' );
|
||||
$hook = new WP_Hook();
|
||||
$tag = __FUNCTION__;
|
||||
$priority = rand( 1, 100 );
|
||||
$accepted_args = rand( 1, 100 );
|
||||
$priority = 1;
|
||||
$accepted_args = 2;
|
||||
|
||||
$hook->add_filter( $tag, $callback, $priority, $accepted_args );
|
||||
$hook->remove_filter( $tag, $callback, $priority );
|
||||
@ -53,8 +53,8 @@ class Tests_Hooks_RemoveFilter extends WP_UnitTestCase {
|
||||
$callback_two = '__return_false';
|
||||
$hook = new WP_Hook();
|
||||
$tag = __FUNCTION__;
|
||||
$priority = rand( 1, 100 );
|
||||
$accepted_args = rand( 1, 100 );
|
||||
$priority = 1;
|
||||
$accepted_args = 2;
|
||||
|
||||
$hook->add_filter( $tag, $callback_one, $priority, $accepted_args );
|
||||
$hook->add_filter( $tag, $callback_two, $priority, $accepted_args );
|
||||
@ -69,8 +69,8 @@ class Tests_Hooks_RemoveFilter extends WP_UnitTestCase {
|
||||
$callback_two = '__return_false';
|
||||
$hook = new WP_Hook();
|
||||
$tag = __FUNCTION__;
|
||||
$priority = rand( 1, 100 );
|
||||
$accepted_args = rand( 1, 100 );
|
||||
$priority = 1;
|
||||
$accepted_args = 2;
|
||||
|
||||
$hook->add_filter( $tag, $callback_one, $priority, $accepted_args );
|
||||
$hook->add_filter( $tag, $callback_two, $priority + 1, $accepted_args );
|
||||
|
||||
@ -181,23 +181,23 @@ class Tests_Image_Intermediate_Size extends WP_UnitTestCase {
|
||||
* @requires function imagejpeg
|
||||
*/
|
||||
public function test_get_intermediate_sizes_by_array_zero_height() {
|
||||
// Generate random width.
|
||||
$random_w = rand( 300, 400 );
|
||||
// Use this width.
|
||||
$width = 300;
|
||||
|
||||
// Only one dimention match shouldn't return false positive (see: #17626).
|
||||
add_image_size( 'test-size', $random_w, 0, false );
|
||||
add_image_size( 'false-height', $random_w, 100, true );
|
||||
add_image_size( 'test-size', $width, 0, false );
|
||||
add_image_size( 'false-height', $width, 100, true );
|
||||
|
||||
$file = DIR_TESTDATA . '/images/waffles.jpg';
|
||||
$id = $this->_make_attachment( $file, 0 );
|
||||
|
||||
$original = wp_get_attachment_metadata( $id );
|
||||
$image_w = $random_w;
|
||||
$image_w = $width;
|
||||
$image_h = round( ( $image_w / $original['width'] ) * $original['height'] );
|
||||
|
||||
// Look for a size by array that exists.
|
||||
// Note: Staying larger than 300px to miss default medium crop.
|
||||
$image = image_get_intermediate_size( $id, array( $random_w, 0 ) );
|
||||
$image = image_get_intermediate_size( $id, array( $width, 0 ) );
|
||||
|
||||
// Test for the expected string because the array will by definition
|
||||
// return with the correct height and width attributes.
|
||||
|
||||
@ -68,8 +68,8 @@ class Tests_Post extends WP_UnitTestCase {
|
||||
$post = array(
|
||||
'post_author' => self::$editor_id,
|
||||
'post_status' => 'publish',
|
||||
'post_content' => rand_str(),
|
||||
'post_title' => rand_str(),
|
||||
'post_content' => "{$post_type}_content",
|
||||
'post_title' => "{$post_type}_title",
|
||||
'tax_input' => array(
|
||||
'post_tag' => 'tag1,tag2',
|
||||
'ctax' => 'cterm1,cterm2',
|
||||
@ -126,8 +126,8 @@ class Tests_Post extends WP_UnitTestCase {
|
||||
$post = array(
|
||||
'post_author' => self::$editor_id,
|
||||
'post_status' => 'publish',
|
||||
'post_content' => rand_str(),
|
||||
'post_title' => rand_str(),
|
||||
'post_content' => 'content',
|
||||
'post_title' => 'title',
|
||||
'post_date' => date_format( date_create( "@{$future_date}" ), 'Y-m-d H:i:s' ),
|
||||
);
|
||||
|
||||
@ -162,8 +162,8 @@ class Tests_Post extends WP_UnitTestCase {
|
||||
$post = array(
|
||||
'post_author' => self::$editor_id,
|
||||
'post_status' => 'publish',
|
||||
'post_content' => rand_str(),
|
||||
'post_title' => rand_str(),
|
||||
'post_content' => 'content',
|
||||
'post_title' => 'title',
|
||||
'post_date' => date_format( date_create( "@{$future_date_1}" ), 'Y-m-d H:i:s' ),
|
||||
);
|
||||
|
||||
@ -207,8 +207,8 @@ class Tests_Post extends WP_UnitTestCase {
|
||||
$post = array(
|
||||
'post_author' => self::$editor_id,
|
||||
'post_status' => 'publish',
|
||||
'post_content' => rand_str(),
|
||||
'post_title' => rand_str(),
|
||||
'post_content' => 'content',
|
||||
'post_title' => 'title',
|
||||
'post_date' => date_format( date_create( "@{$future_date_1}" ), 'Y-m-d H:i:s' ),
|
||||
);
|
||||
|
||||
@ -249,8 +249,8 @@ class Tests_Post extends WP_UnitTestCase {
|
||||
$post = array(
|
||||
'post_author' => self::$editor_id,
|
||||
'post_status' => 'draft',
|
||||
'post_content' => rand_str(),
|
||||
'post_title' => rand_str(),
|
||||
'post_content' => 'content',
|
||||
'post_title' => 'title',
|
||||
'post_date' => date_format( date_create( "@{$future_date}" ), 'Y-m-d H:i:s' ),
|
||||
);
|
||||
|
||||
@ -284,8 +284,8 @@ class Tests_Post extends WP_UnitTestCase {
|
||||
$post = array(
|
||||
'post_author' => self::$editor_id,
|
||||
'post_status' => 'publish',
|
||||
'post_content' => rand_str(),
|
||||
'post_title' => rand_str(),
|
||||
'post_content' => 'content',
|
||||
'post_title' => 'title',
|
||||
'post_date' => date_format( date_create( "@{$future_date_1}" ), 'Y-m-d H:i:s' ),
|
||||
);
|
||||
|
||||
@ -328,8 +328,8 @@ class Tests_Post extends WP_UnitTestCase {
|
||||
$post = array(
|
||||
'post_author' => self::$editor_id,
|
||||
'post_status' => 'publish',
|
||||
'post_content' => rand_str(),
|
||||
'post_title' => rand_str(),
|
||||
'post_content' => "{$status}_content",
|
||||
'post_title' => "{$status}_title",
|
||||
'post_date' => date_format( date_create( "@{$future_date_1}" ), 'Y-m-d H:i:s' ),
|
||||
);
|
||||
|
||||
@ -370,8 +370,8 @@ class Tests_Post extends WP_UnitTestCase {
|
||||
$post = array(
|
||||
'post_author' => self::$editor_id,
|
||||
'post_status' => 'private',
|
||||
'post_content' => rand_str(),
|
||||
'post_title' => rand_str(),
|
||||
'post_content' => 'content',
|
||||
'post_title' => 'title',
|
||||
'post_date' => date_format( date_create( "@{$future_date}" ), 'Y-m-d H:i:s' ),
|
||||
);
|
||||
|
||||
@ -404,8 +404,8 @@ class Tests_Post extends WP_UnitTestCase {
|
||||
$post = array(
|
||||
'post_author' => self::$editor_id,
|
||||
'post_status' => 'publish',
|
||||
'post_content' => rand_str(),
|
||||
'post_title' => rand_str(),
|
||||
'post_content' => 'content',
|
||||
'post_title' => 'title',
|
||||
'post_date' => '2012-02-30 00:00:00',
|
||||
);
|
||||
|
||||
@ -427,8 +427,8 @@ class Tests_Post extends WP_UnitTestCase {
|
||||
$post = array(
|
||||
'post_author' => self::$editor_id,
|
||||
'post_status' => 'publish',
|
||||
'post_content' => rand_str(),
|
||||
'post_title' => rand_str(),
|
||||
'post_content' => 'content',
|
||||
'post_title' => 'title',
|
||||
'post_date' => date_format( date_create( "@{$future_date_1}" ), 'Y-m-d H:i:s' ),
|
||||
);
|
||||
|
||||
@ -533,8 +533,8 @@ class Tests_Post extends WP_UnitTestCase {
|
||||
$post = array(
|
||||
'post_author' => self::$editor_id,
|
||||
'post_status' => 'publish',
|
||||
'post_content' => rand_str(),
|
||||
'post_title' => rand_str(),
|
||||
'post_content' => 'content',
|
||||
'post_title' => 'title',
|
||||
'post_date' => date_format( date_create( "@{$future_date}" ), 'Y-m-d H:i:s' ),
|
||||
);
|
||||
|
||||
@ -564,7 +564,7 @@ class Tests_Post extends WP_UnitTestCase {
|
||||
$post = array(
|
||||
'post_author' => self::$editor_id,
|
||||
'post_status' => 'publish',
|
||||
'post_content' => rand_str(),
|
||||
'post_content' => 'content',
|
||||
'post_title' => '',
|
||||
'post_date' => '2007-10-31 06:15:00',
|
||||
);
|
||||
@ -782,11 +782,11 @@ class Tests_Post extends WP_UnitTestCase {
|
||||
|
||||
register_taxonomy( 'test_tax', 'post' );
|
||||
|
||||
$title = rand_str();
|
||||
$title = 'title';
|
||||
$post_data = array(
|
||||
'post_author' => self::$editor_id,
|
||||
'post_status' => 'publish',
|
||||
'post_content' => rand_str(),
|
||||
'post_content' => 'content',
|
||||
'post_title' => $title,
|
||||
'tax_input' => array(
|
||||
'test_tax' => array( 'term', 'term2', 'term3' ),
|
||||
@ -906,7 +906,7 @@ class Tests_Post extends WP_UnitTestCase {
|
||||
register_taxonomy( $tax, $post_type );
|
||||
|
||||
$post = self::factory()->post->create( array( 'post_type' => $post_type ) );
|
||||
wp_set_object_terms( $post, rand_str(), $tax );
|
||||
wp_set_object_terms( $post, 'foo', $tax );
|
||||
|
||||
$wp_tag_cloud = wp_tag_cloud(
|
||||
array(
|
||||
@ -973,8 +973,8 @@ class Tests_Post extends WP_UnitTestCase {
|
||||
array(
|
||||
'post_author' => self::$editor_id,
|
||||
'post_status' => 'publish',
|
||||
'post_content' => rand_str(),
|
||||
'post_title' => rand_str(),
|
||||
'post_content' => 'content',
|
||||
'post_title' => 'title',
|
||||
)
|
||||
);
|
||||
$post = get_post( $post_id );
|
||||
@ -991,8 +991,8 @@ class Tests_Post extends WP_UnitTestCase {
|
||||
array(
|
||||
'post_author' => self::$editor_id,
|
||||
'post_status' => 'publish',
|
||||
'post_content' => rand_str(),
|
||||
'post_title' => rand_str(),
|
||||
'post_content' => 'content',
|
||||
'post_title' => 'title',
|
||||
'post_type' => 'page',
|
||||
)
|
||||
);
|
||||
@ -1203,8 +1203,8 @@ class Tests_Post extends WP_UnitTestCase {
|
||||
$post = array(
|
||||
'post_author' => self::$editor_id,
|
||||
'post_status' => 'publish',
|
||||
'post_content' => rand_str(),
|
||||
'post_title' => rand_str(),
|
||||
'post_content' => 'content',
|
||||
'post_title' => 'title',
|
||||
'post_date_gmt' => '2014-01-01 12:00:00',
|
||||
);
|
||||
|
||||
|
||||
@ -272,8 +272,8 @@ class Tests_Post_Attachments extends WP_UnitTestCase {
|
||||
|
||||
$post_id = wp_insert_post(
|
||||
array(
|
||||
'post_content' => rand_str(),
|
||||
'post_title' => rand_str(),
|
||||
'post_content' => 'content',
|
||||
'post_title' => 'title',
|
||||
)
|
||||
);
|
||||
|
||||
|
||||
@ -23,8 +23,8 @@ class Tests_Post_Meta extends WP_UnitTestCase {
|
||||
array(
|
||||
'post_author' => self::$author->ID,
|
||||
'post_status' => 'publish',
|
||||
'post_content' => rand_str(),
|
||||
'post_title' => rand_str(),
|
||||
'post_content' => 'content',
|
||||
'post_title' => 'title',
|
||||
)
|
||||
);
|
||||
|
||||
@ -32,8 +32,8 @@ class Tests_Post_Meta extends WP_UnitTestCase {
|
||||
array(
|
||||
'post_author' => self::$author->ID,
|
||||
'post_status' => 'publish',
|
||||
'post_content' => rand_str(),
|
||||
'post_title' => rand_str(),
|
||||
'post_content' => 'content',
|
||||
'post_title' => 'title',
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
@ -12,7 +12,7 @@ class Tests_Post_Nav_Menu extends WP_UnitTestCase {
|
||||
public function set_up() {
|
||||
parent::set_up();
|
||||
|
||||
$this->menu_id = wp_create_nav_menu( rand_str() );
|
||||
$this->menu_id = wp_create_nav_menu( 'foo' );
|
||||
}
|
||||
|
||||
/**
|
||||
@ -255,8 +255,8 @@ class Tests_Post_Nav_Menu extends WP_UnitTestCase {
|
||||
*/
|
||||
public function test_wp_setup_nav_menu_item_for_post_type_archive() {
|
||||
|
||||
$post_type_slug = rand_str( 12 );
|
||||
$post_type_description = rand_str();
|
||||
$post_type_slug = 'fooo-bar-baz';
|
||||
$post_type_description = 'foo';
|
||||
register_post_type(
|
||||
$post_type_slug,
|
||||
array(
|
||||
@ -288,7 +288,7 @@ class Tests_Post_Nav_Menu extends WP_UnitTestCase {
|
||||
*/
|
||||
public function test_wp_setup_nav_menu_item_for_post_type_archive_no_description() {
|
||||
|
||||
$post_type_slug = rand_str( 12 );
|
||||
$post_type_slug = 'fooo-bar-baz';
|
||||
$post_type_description = '';
|
||||
register_post_type(
|
||||
$post_type_slug,
|
||||
@ -319,8 +319,8 @@ class Tests_Post_Nav_Menu extends WP_UnitTestCase {
|
||||
*/
|
||||
public function test_wp_setup_nav_menu_item_for_post_type_archive_custom_description() {
|
||||
|
||||
$post_type_slug = rand_str( 12 );
|
||||
$post_type_description = rand_str();
|
||||
$post_type_slug = 'fooo-bar-baz';
|
||||
$post_type_description = 'foobaz';
|
||||
register_post_type(
|
||||
$post_type_slug,
|
||||
array(
|
||||
@ -331,7 +331,7 @@ class Tests_Post_Nav_Menu extends WP_UnitTestCase {
|
||||
)
|
||||
);
|
||||
|
||||
$menu_item_description = rand_str();
|
||||
$menu_item_description = 'foo_description';
|
||||
|
||||
$post_type_archive_item_id = wp_update_nav_menu_item(
|
||||
$this->menu_id,
|
||||
@ -354,7 +354,7 @@ class Tests_Post_Nav_Menu extends WP_UnitTestCase {
|
||||
*/
|
||||
public function test_wp_setup_nav_menu_item_for_unknown_post_type_archive_no_description() {
|
||||
|
||||
$post_type_slug = rand_str( 12 );
|
||||
$post_type_slug = 'fooo-bar-baz';
|
||||
|
||||
$post_type_archive_item_id = wp_update_nav_menu_item(
|
||||
$this->menu_id,
|
||||
|
||||
@ -132,33 +132,33 @@ class Tests_Post_Query extends WP_UnitTestCase {
|
||||
$post_id1 = self::factory()->post->create(
|
||||
array(
|
||||
'post_type' => 'page',
|
||||
'menu_order' => rand( 1, 100 ),
|
||||
'menu_order' => 1,
|
||||
)
|
||||
);
|
||||
$post_id2 = self::factory()->post->create(
|
||||
array(
|
||||
'post_type' => 'page',
|
||||
'menu_order' => rand( 1, 100 ),
|
||||
'menu_order' => 2,
|
||||
)
|
||||
);
|
||||
$post_id3 = self::factory()->post->create(
|
||||
array(
|
||||
'post_type' => 'page',
|
||||
'post_parent' => $post_id2,
|
||||
'menu_order' => rand( 1, 100 ),
|
||||
'menu_order' => 3,
|
||||
)
|
||||
);
|
||||
$post_id4 = self::factory()->post->create(
|
||||
array(
|
||||
'post_type' => 'page',
|
||||
'post_parent' => $post_id2,
|
||||
'menu_order' => rand( 1, 100 ),
|
||||
'menu_order' => 4,
|
||||
)
|
||||
);
|
||||
$post_id5 = self::factory()->post->create(
|
||||
array(
|
||||
'post_type' => 'page',
|
||||
'menu_order' => rand( 1, 100 ),
|
||||
'menu_order' => 5,
|
||||
)
|
||||
);
|
||||
|
||||
@ -219,7 +219,7 @@ class Tests_Post_Query extends WP_UnitTestCase {
|
||||
$post_id,
|
||||
array(
|
||||
'post_mime_type' => 'image/jpeg',
|
||||
'menu_order' => rand( 1, 100 ),
|
||||
'menu_order' => 1,
|
||||
)
|
||||
);
|
||||
$att_ids[2] = self::factory()->attachment->create_object(
|
||||
@ -227,7 +227,7 @@ class Tests_Post_Query extends WP_UnitTestCase {
|
||||
$post_id,
|
||||
array(
|
||||
'post_mime_type' => 'image/jpeg',
|
||||
'menu_order' => rand( 1, 100 ),
|
||||
'menu_order' => 2,
|
||||
)
|
||||
);
|
||||
$att_ids[3] = self::factory()->attachment->create_object(
|
||||
@ -235,7 +235,7 @@ class Tests_Post_Query extends WP_UnitTestCase {
|
||||
$post_id,
|
||||
array(
|
||||
'post_mime_type' => 'image/jpeg',
|
||||
'menu_order' => rand( 1, 100 ),
|
||||
'menu_order' => 3,
|
||||
)
|
||||
);
|
||||
$att_ids[4] = self::factory()->attachment->create_object(
|
||||
@ -243,7 +243,7 @@ class Tests_Post_Query extends WP_UnitTestCase {
|
||||
$post_id,
|
||||
array(
|
||||
'post_mime_type' => 'image/jpeg',
|
||||
'menu_order' => rand( 1, 100 ),
|
||||
'menu_order' => 4,
|
||||
)
|
||||
);
|
||||
$att_ids[5] = self::factory()->attachment->create_object(
|
||||
@ -251,7 +251,7 @@ class Tests_Post_Query extends WP_UnitTestCase {
|
||||
$post_id,
|
||||
array(
|
||||
'post_mime_type' => 'image/jpeg',
|
||||
'menu_order' => rand( 1, 100 ),
|
||||
'menu_order' => 5,
|
||||
)
|
||||
);
|
||||
|
||||
|
||||
@ -17,7 +17,7 @@ class Tests_Post_Revisions extends WP_UnitTestCase {
|
||||
|
||||
public function set_up() {
|
||||
parent::set_up();
|
||||
$this->post_type = rand_str( 20 );
|
||||
$this->post_type = 'test-revision';
|
||||
}
|
||||
|
||||
/**
|
||||
@ -446,7 +446,7 @@ class Tests_Post_Revisions extends WP_UnitTestCase {
|
||||
array(
|
||||
'post_status' => 'publish',
|
||||
'ID' => $post_id,
|
||||
'post_content' => rand_str(),
|
||||
'post_content' => 'content',
|
||||
)
|
||||
);
|
||||
|
||||
|
||||
@ -21,7 +21,7 @@ class Tests_Post_Types extends WP_UnitTestCase {
|
||||
public function set_up() {
|
||||
parent::set_up();
|
||||
|
||||
$this->post_type = rand_str( 20 );
|
||||
$this->post_type = 'foo1';
|
||||
}
|
||||
|
||||
public function test_register_post_type() {
|
||||
|
||||
@ -21,7 +21,7 @@ class Tests_Query_CommentCount extends WP_UnitTestCase {
|
||||
public static function wpSetUpBeforeClass( WP_UnitTest_Factory $factory ) {
|
||||
$post_id = $factory->post->create(
|
||||
array(
|
||||
'post_content' => 1 . rand_str() . ' about',
|
||||
'post_content' => '1 about',
|
||||
'post_type' => self::$post_type,
|
||||
)
|
||||
);
|
||||
@ -30,7 +30,7 @@ class Tests_Query_CommentCount extends WP_UnitTestCase {
|
||||
|
||||
$post_id = $factory->post->create(
|
||||
array(
|
||||
'post_content' => 1 . rand_str() . ' about',
|
||||
'post_content' => '2 about',
|
||||
'post_type' => self::$post_type,
|
||||
)
|
||||
);
|
||||
@ -41,7 +41,7 @@ class Tests_Query_CommentCount extends WP_UnitTestCase {
|
||||
|
||||
$post_id = $factory->post->create(
|
||||
array(
|
||||
'post_content' => 1 . rand_str() . ' about',
|
||||
'post_content' => '3 about',
|
||||
'post_type' => self::$post_type,
|
||||
)
|
||||
);
|
||||
@ -52,7 +52,7 @@ class Tests_Query_CommentCount extends WP_UnitTestCase {
|
||||
|
||||
$post_id = $factory->post->create(
|
||||
array(
|
||||
'post_content' => 1 . rand_str() . ' about',
|
||||
'post_content' => '4 about',
|
||||
'post_type' => self::$post_type,
|
||||
)
|
||||
);
|
||||
|
||||
@ -10,7 +10,7 @@ class Tests_Query_Search extends WP_UnitTestCase {
|
||||
public function set_up() {
|
||||
parent::set_up();
|
||||
|
||||
$this->post_type = rand_str( 12 );
|
||||
$this->post_type = 'foo1';
|
||||
register_post_type( $this->post_type );
|
||||
|
||||
$this->q = new WP_Query();
|
||||
@ -36,7 +36,7 @@ class Tests_Query_Search extends WP_UnitTestCase {
|
||||
foreach ( range( 1, 7 ) as $i ) {
|
||||
self::factory()->post->create(
|
||||
array(
|
||||
'post_content' => $i . rand_str() . ' about',
|
||||
'post_content' => "{$i} about",
|
||||
'post_type' => $this->post_type,
|
||||
)
|
||||
);
|
||||
|
||||
@ -1209,8 +1209,8 @@ class Tests_Query_TaxQuery extends WP_UnitTestCase {
|
||||
register_taxonomy_for_object_type( 'post_tag', 'attachment:image' );
|
||||
$tag_id = self::factory()->term->create(
|
||||
array(
|
||||
'slug' => rand_str(),
|
||||
'name' => rand_str(),
|
||||
'slug' => 'foo-bar',
|
||||
'name' => 'Foo Bar',
|
||||
)
|
||||
);
|
||||
$image_id = self::factory()->attachment->create_object(
|
||||
|
||||
@ -522,8 +522,8 @@ class WP_Test_REST_Attachments_Controller extends WP_Test_REST_Post_Type_Control
|
||||
|
||||
public function test_get_items_invalid_date() {
|
||||
$request = new WP_REST_Request( 'GET', '/wp/v2/media' );
|
||||
$request->set_param( 'after', rand_str() );
|
||||
$request->set_param( 'before', rand_str() );
|
||||
$request->set_param( 'after', 'foo' );
|
||||
$request->set_param( 'before', 'bar' );
|
||||
$response = rest_get_server()->dispatch( $request );
|
||||
$this->assertErrorResponse( 'rest_invalid_param', $response, 400 );
|
||||
}
|
||||
@ -570,8 +570,8 @@ class WP_Test_REST_Attachments_Controller extends WP_Test_REST_Post_Type_Control
|
||||
*/
|
||||
public function test_get_items_invalid_modified_date() {
|
||||
$request = new WP_REST_Request( 'GET', '/wp/v2/media' );
|
||||
$request->set_param( 'modified_after', rand_str() );
|
||||
$request->set_param( 'modified_before', rand_str() );
|
||||
$request->set_param( 'modified_after', 'foo' );
|
||||
$request->set_param( 'modified_before', 'bar' );
|
||||
$response = rest_get_server()->dispatch( $request );
|
||||
$this->assertErrorResponse( 'rest_invalid_param', $response, 400 );
|
||||
}
|
||||
|
||||
@ -888,8 +888,8 @@ class WP_Test_REST_Comments_Controller extends WP_Test_REST_Controller_Testcase
|
||||
|
||||
public function test_get_comments_invalid_date() {
|
||||
$request = new WP_REST_Request( 'GET', '/wp/v2/comments' );
|
||||
$request->set_param( 'after', rand_str() );
|
||||
$request->set_param( 'before', rand_str() );
|
||||
$request->set_param( 'after', 'foo' );
|
||||
$request->set_param( 'before', 'bar' );
|
||||
$response = rest_get_server()->dispatch( $request );
|
||||
$this->assertErrorResponse( 'rest_invalid_param', $response, 400 );
|
||||
}
|
||||
@ -1477,7 +1477,7 @@ class WP_Test_REST_Comments_Controller extends WP_Test_REST_Controller_Testcase
|
||||
'author_email' => 'lovejoy@example.com',
|
||||
'author_url' => 'http://timothylovejoy.jr',
|
||||
'content' => 'It\'s all over\, people! We don\'t have a prayer!',
|
||||
'date' => rand_str(),
|
||||
'date' => 'foo-bar',
|
||||
);
|
||||
|
||||
$request = new WP_REST_Request( 'POST', '/wp/v2/comments' );
|
||||
@ -2625,8 +2625,8 @@ class WP_Test_REST_Comments_Controller extends WP_Test_REST_Controller_Testcase
|
||||
wp_set_current_user( self::$admin_id );
|
||||
|
||||
$params = array(
|
||||
'content' => rand_str(),
|
||||
'date' => rand_str(),
|
||||
'content' => 'content',
|
||||
'date' => 'foo',
|
||||
);
|
||||
|
||||
$request = new WP_REST_Request( 'PUT', sprintf( '/wp/v2/comments/%d', self::$approved_id ) );
|
||||
@ -2641,8 +2641,8 @@ class WP_Test_REST_Comments_Controller extends WP_Test_REST_Controller_Testcase
|
||||
wp_set_current_user( self::$admin_id );
|
||||
|
||||
$params = array(
|
||||
'content' => rand_str(),
|
||||
'date_gmt' => rand_str(),
|
||||
'content' => 'content',
|
||||
'date_gmt' => 'foo',
|
||||
);
|
||||
|
||||
$request = new WP_REST_Request( 'PUT', sprintf( '/wp/v2/comments/%d', self::$approved_id ) );
|
||||
@ -2770,7 +2770,7 @@ class WP_Test_REST_Comments_Controller extends WP_Test_REST_Controller_Testcase
|
||||
// Change the comment parent.
|
||||
$request = new WP_REST_Request( 'PUT', sprintf( '/wp/v2/comments/%s', $child_comment ) );
|
||||
$request->set_param( 'parent', $comment_id_1 );
|
||||
$request->set_param( 'content', rand_str() );
|
||||
$request->set_param( 'content', 'foo bar' );
|
||||
$response = rest_get_server()->dispatch( $request );
|
||||
$this->assertSame( 200, $response->get_status() );
|
||||
|
||||
|
||||
@ -330,8 +330,8 @@ class WP_Test_REST_Pages_Controller extends WP_Test_REST_Post_Type_Controller_Te
|
||||
|
||||
public function test_get_items_invalid_date() {
|
||||
$request = new WP_REST_Request( 'GET', '/wp/v2/pages' );
|
||||
$request->set_param( 'after', rand_str() );
|
||||
$request->set_param( 'before', rand_str() );
|
||||
$request->set_param( 'after', 'foo' );
|
||||
$request->set_param( 'before', 'bar' );
|
||||
$response = rest_get_server()->dispatch( $request );
|
||||
$this->assertErrorResponse( 'rest_invalid_param', $response, 400 );
|
||||
}
|
||||
@ -369,8 +369,8 @@ class WP_Test_REST_Pages_Controller extends WP_Test_REST_Post_Type_Controller_Te
|
||||
*/
|
||||
public function test_get_items_invalid_modified_date() {
|
||||
$request = new WP_REST_Request( 'GET', '/wp/v2/pages' );
|
||||
$request->set_param( 'modified_after', rand_str() );
|
||||
$request->set_param( 'modified_before', rand_str() );
|
||||
$request->set_param( 'modified_after', 'foo' );
|
||||
$request->set_param( 'modified_before', 'bar' );
|
||||
$response = rest_get_server()->dispatch( $request );
|
||||
$this->assertErrorResponse( 'rest_invalid_param', $response, 400 );
|
||||
}
|
||||
|
||||
@ -1694,8 +1694,8 @@ class WP_Test_REST_Posts_Controller extends WP_Test_REST_Post_Type_Controller_Te
|
||||
|
||||
public function test_get_items_invalid_date() {
|
||||
$request = new WP_REST_Request( 'GET', '/wp/v2/posts' );
|
||||
$request->set_param( 'after', rand_str() );
|
||||
$request->set_param( 'before', rand_str() );
|
||||
$request->set_param( 'after', 'foo' );
|
||||
$request->set_param( 'before', 'bar' );
|
||||
$response = rest_get_server()->dispatch( $request );
|
||||
$this->assertErrorResponse( 'rest_invalid_param', $response, 400 );
|
||||
}
|
||||
@ -1719,8 +1719,8 @@ class WP_Test_REST_Posts_Controller extends WP_Test_REST_Post_Type_Controller_Te
|
||||
*/
|
||||
public function test_get_items_invalid_modified_date() {
|
||||
$request = new WP_REST_Request( 'GET', '/wp/v2/posts' );
|
||||
$request->set_param( 'modified_after', rand_str() );
|
||||
$request->set_param( 'modified_before', rand_str() );
|
||||
$request->set_param( 'modified_after', 'foo' );
|
||||
$request->set_param( 'modified_before', 'bar' );
|
||||
$response = rest_get_server()->dispatch( $request );
|
||||
$this->assertErrorResponse( 'rest_invalid_param', $response, 400 );
|
||||
}
|
||||
@ -2697,7 +2697,7 @@ class WP_Test_REST_Posts_Controller extends WP_Test_REST_Post_Type_Controller_Te
|
||||
0,
|
||||
array(
|
||||
'post_mime_type' => 'image/jpeg',
|
||||
'menu_order' => rand( 1, 100 ),
|
||||
'menu_order' => 1,
|
||||
)
|
||||
);
|
||||
|
||||
@ -3310,7 +3310,7 @@ class WP_Test_REST_Posts_Controller extends WP_Test_REST_Post_Type_Controller_Te
|
||||
public function test_update_post_ignore_readonly() {
|
||||
wp_set_current_user( self::$editor_id );
|
||||
|
||||
$new_content = rand_str();
|
||||
$new_content = 'foo bar baz';
|
||||
$expected_modified = current_time( 'mysql' );
|
||||
|
||||
$request = new WP_REST_Request( 'PUT', sprintf( '/wp/v2/posts/%d', self::$post_id ) );
|
||||
@ -3375,7 +3375,7 @@ class WP_Test_REST_Posts_Controller extends WP_Test_REST_Post_Type_Controller_Te
|
||||
$request = new WP_REST_Request( 'PUT', sprintf( '/wp/v2/posts/%d', self::$post_id ) );
|
||||
$params = $this->set_post_data(
|
||||
array(
|
||||
'date' => rand_str(),
|
||||
'date' => 'foo',
|
||||
)
|
||||
);
|
||||
$request->set_body_params( $params );
|
||||
@ -3390,7 +3390,7 @@ class WP_Test_REST_Posts_Controller extends WP_Test_REST_Post_Type_Controller_Te
|
||||
$request = new WP_REST_Request( 'PUT', sprintf( '/wp/v2/posts/%d', self::$post_id ) );
|
||||
$params = $this->set_post_data(
|
||||
array(
|
||||
'date_gmt' => rand_str(),
|
||||
'date_gmt' => 'foo',
|
||||
)
|
||||
);
|
||||
$request->set_body_params( $params );
|
||||
|
||||
@ -173,7 +173,7 @@ class Tests_Rewrite extends WP_UnitTestCase {
|
||||
public function test_url_to_postid_custom_post_type() {
|
||||
delete_option( 'rewrite_rules' );
|
||||
|
||||
$post_type = rand_str( 12 );
|
||||
$post_type = 'url_to_postid';
|
||||
register_post_type( $post_type, array( 'public' => true ) );
|
||||
|
||||
$id = self::factory()->post->create( array( 'post_type' => $post_type ) );
|
||||
|
||||
@ -23,7 +23,7 @@ class Tests_Rewrite_NumericSlugs extends WP_UnitTestCase {
|
||||
array(
|
||||
'post_author' => $this->author_id,
|
||||
'post_status' => 'publish',
|
||||
'post_content' => rand_str(),
|
||||
'post_content' => 'content',
|
||||
'post_title' => '',
|
||||
'post_name' => '2015',
|
||||
'post_date' => '2015-02-01 01:00:00',
|
||||
@ -53,7 +53,7 @@ class Tests_Rewrite_NumericSlugs extends WP_UnitTestCase {
|
||||
array(
|
||||
'post_author' => $this->author_id,
|
||||
'post_status' => 'publish',
|
||||
'post_content' => rand_str(),
|
||||
'post_content' => 'content',
|
||||
'post_title' => '',
|
||||
'post_name' => '2015',
|
||||
'post_date' => '2015-02-01 01:00:00',
|
||||
@ -80,7 +80,7 @@ class Tests_Rewrite_NumericSlugs extends WP_UnitTestCase {
|
||||
array(
|
||||
'post_author' => $this->author_id,
|
||||
'post_status' => 'publish',
|
||||
'post_content' => rand_str(),
|
||||
'post_content' => 'content',
|
||||
'post_title' => '2015',
|
||||
'post_date' => '2015-02-01 01:00:00',
|
||||
)
|
||||
@ -98,7 +98,7 @@ class Tests_Rewrite_NumericSlugs extends WP_UnitTestCase {
|
||||
array(
|
||||
'post_author' => $this->author_id,
|
||||
'post_status' => 'publish',
|
||||
'post_content' => rand_str(),
|
||||
'post_content' => 'content',
|
||||
'post_title' => '2015',
|
||||
'post_date' => '2015-02-01 01:00:00',
|
||||
)
|
||||
@ -114,7 +114,7 @@ class Tests_Rewrite_NumericSlugs extends WP_UnitTestCase {
|
||||
array(
|
||||
'post_author' => $this->author_id,
|
||||
'post_status' => 'publish',
|
||||
'post_content' => rand_str(),
|
||||
'post_content' => 'content',
|
||||
'post_title' => '',
|
||||
'post_name' => '02',
|
||||
'post_date' => '2015-02-01 01:00:00',
|
||||
@ -133,7 +133,7 @@ class Tests_Rewrite_NumericSlugs extends WP_UnitTestCase {
|
||||
array(
|
||||
'post_author' => $this->author_id,
|
||||
'post_status' => 'publish',
|
||||
'post_content' => rand_str(),
|
||||
'post_content' => 'content',
|
||||
'post_title' => '',
|
||||
'post_name' => '02',
|
||||
'post_date' => '2015-02-01 01:00:00',
|
||||
@ -150,7 +150,7 @@ class Tests_Rewrite_NumericSlugs extends WP_UnitTestCase {
|
||||
array(
|
||||
'post_author' => $this->author_id,
|
||||
'post_status' => 'publish',
|
||||
'post_content' => rand_str(),
|
||||
'post_content' => 'content',
|
||||
'post_title' => '',
|
||||
'post_name' => '2',
|
||||
'post_date' => '2015-02-01 01:00:00',
|
||||
@ -169,7 +169,7 @@ class Tests_Rewrite_NumericSlugs extends WP_UnitTestCase {
|
||||
array(
|
||||
'post_author' => $this->author_id,
|
||||
'post_status' => 'publish',
|
||||
'post_content' => rand_str(),
|
||||
'post_content' => 'content',
|
||||
'post_title' => '',
|
||||
'post_name' => '2',
|
||||
'post_date' => '2015-02-01 01:00:00',
|
||||
@ -186,7 +186,7 @@ class Tests_Rewrite_NumericSlugs extends WP_UnitTestCase {
|
||||
array(
|
||||
'post_author' => $this->author_id,
|
||||
'post_status' => 'publish',
|
||||
'post_content' => rand_str(),
|
||||
'post_content' => 'content',
|
||||
'post_title' => '02',
|
||||
'post_date' => '2015-02-01 01:00:00',
|
||||
)
|
||||
@ -204,7 +204,7 @@ class Tests_Rewrite_NumericSlugs extends WP_UnitTestCase {
|
||||
array(
|
||||
'post_author' => $this->author_id,
|
||||
'post_status' => 'publish',
|
||||
'post_content' => rand_str(),
|
||||
'post_content' => 'content',
|
||||
'post_title' => '02',
|
||||
'post_date' => '2015-02-01 01:00:00',
|
||||
)
|
||||
@ -220,7 +220,7 @@ class Tests_Rewrite_NumericSlugs extends WP_UnitTestCase {
|
||||
array(
|
||||
'post_author' => $this->author_id,
|
||||
'post_status' => 'publish',
|
||||
'post_content' => rand_str(),
|
||||
'post_content' => 'content',
|
||||
'post_title' => '2',
|
||||
'post_date' => '2015-02-01 01:00:00',
|
||||
)
|
||||
@ -238,7 +238,7 @@ class Tests_Rewrite_NumericSlugs extends WP_UnitTestCase {
|
||||
array(
|
||||
'post_author' => $this->author_id,
|
||||
'post_status' => 'publish',
|
||||
'post_content' => rand_str(),
|
||||
'post_content' => 'content',
|
||||
'post_title' => '2',
|
||||
'post_date' => '2015-02-01 01:00:00',
|
||||
)
|
||||
@ -254,7 +254,7 @@ class Tests_Rewrite_NumericSlugs extends WP_UnitTestCase {
|
||||
array(
|
||||
'post_author' => $this->author_id,
|
||||
'post_status' => 'publish',
|
||||
'post_content' => rand_str(),
|
||||
'post_content' => 'content',
|
||||
'post_title' => '',
|
||||
'post_name' => '01',
|
||||
'post_date' => '2015-02-01 01:00:00',
|
||||
@ -273,7 +273,7 @@ class Tests_Rewrite_NumericSlugs extends WP_UnitTestCase {
|
||||
array(
|
||||
'post_author' => $this->author_id,
|
||||
'post_status' => 'publish',
|
||||
'post_content' => rand_str(),
|
||||
'post_content' => 'content',
|
||||
'post_title' => '',
|
||||
'post_name' => '01',
|
||||
'post_date' => '2015-02-01 01:00:00',
|
||||
@ -290,7 +290,7 @@ class Tests_Rewrite_NumericSlugs extends WP_UnitTestCase {
|
||||
array(
|
||||
'post_author' => $this->author_id,
|
||||
'post_status' => 'publish',
|
||||
'post_content' => rand_str(),
|
||||
'post_content' => 'content',
|
||||
'post_title' => '01',
|
||||
'post_date' => '2015-02-01 01:00:00',
|
||||
)
|
||||
@ -308,7 +308,7 @@ class Tests_Rewrite_NumericSlugs extends WP_UnitTestCase {
|
||||
array(
|
||||
'post_author' => $this->author_id,
|
||||
'post_status' => 'publish',
|
||||
'post_content' => rand_str(),
|
||||
'post_content' => 'content',
|
||||
'post_title' => '01',
|
||||
'post_date' => '2015-02-01 01:00:00',
|
||||
)
|
||||
@ -324,7 +324,7 @@ class Tests_Rewrite_NumericSlugs extends WP_UnitTestCase {
|
||||
array(
|
||||
'post_author' => $this->author_id,
|
||||
'post_status' => 'publish',
|
||||
'post_content' => rand_str(),
|
||||
'post_content' => 'content',
|
||||
'post_title' => '01',
|
||||
'post_date' => '2015-02-01 01:00:00',
|
||||
)
|
||||
|
||||
@ -17,7 +17,7 @@ class Tests_Taxonomy extends WP_UnitTestCase {
|
||||
*/
|
||||
public function test_get_unknown_taxonomies() {
|
||||
// Taxonomies for an unknown object type.
|
||||
$this->assertSame( array(), get_object_taxonomies( rand_str() ) );
|
||||
$this->assertSame( array(), get_object_taxonomies( 'unknown' ) );
|
||||
$this->assertSame( array(), get_object_taxonomies( '' ) );
|
||||
$this->assertSame( array(), get_object_taxonomies( 0 ) );
|
||||
$this->assertSame( array(), get_object_taxonomies( null ) );
|
||||
@ -144,7 +144,7 @@ class Tests_Taxonomy extends WP_UnitTestCase {
|
||||
public function test_register_taxonomy() {
|
||||
|
||||
// Make up a new taxonomy name, and ensure it's unused.
|
||||
$tax = rand_str();
|
||||
$tax = 'tax_new';
|
||||
$this->assertFalse( taxonomy_exists( $tax ) );
|
||||
|
||||
register_taxonomy( $tax, 'post' );
|
||||
@ -158,7 +158,7 @@ class Tests_Taxonomy extends WP_UnitTestCase {
|
||||
public function test_register_hierarchical_taxonomy() {
|
||||
|
||||
// Make up a new taxonomy name, and ensure it's unused.
|
||||
$tax = rand_str();
|
||||
$tax = 'tax_new';
|
||||
$this->assertFalse( taxonomy_exists( $tax ) );
|
||||
|
||||
register_taxonomy( $tax, 'post', array( 'hierarchical' => true ) );
|
||||
|
||||
@ -51,14 +51,17 @@ class Tests_Term extends WP_UnitTestCase {
|
||||
*/
|
||||
public function test_is_term_type() {
|
||||
// Insert a term.
|
||||
$term = rand_str();
|
||||
$term = 'term_new';
|
||||
$t = wp_insert_term( $term, $this->taxonomy );
|
||||
$this->assertIsArray( $t );
|
||||
$term_obj = get_term_by( 'name', $term, $this->taxonomy );
|
||||
$this->assertEquals( $t['term_id'], term_exists( $term_obj->slug ) );
|
||||
|
||||
$exists = term_exists( $term_obj->slug );
|
||||
// Clean up.
|
||||
$this->assertTrue( wp_delete_term( $t['term_id'], $this->taxonomy ) );
|
||||
$deleted = wp_delete_term( $t['term_id'], $this->taxonomy );
|
||||
|
||||
$this->assertEquals( $t['term_id'], $exists );
|
||||
$this->assertTrue( $deleted );
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@ -91,7 +91,7 @@ class Tests_Term_getTermField extends WP_UnitTestCase {
|
||||
}
|
||||
|
||||
public function test_get_term_field_name() {
|
||||
$name = rand_str( 15 );
|
||||
$name = 'baz';
|
||||
|
||||
$term = self::factory()->term->create_and_get(
|
||||
array(
|
||||
@ -106,7 +106,7 @@ class Tests_Term_getTermField extends WP_UnitTestCase {
|
||||
}
|
||||
|
||||
public function test_get_term_field_slug_when_slug_is_set() {
|
||||
$slug = rand_str( 15 );
|
||||
$slug = 'baz';
|
||||
|
||||
$term = self::factory()->term->create_and_get(
|
||||
array(
|
||||
@ -121,7 +121,7 @@ class Tests_Term_getTermField extends WP_UnitTestCase {
|
||||
}
|
||||
|
||||
public function test_get_term_field_slug_when_slug_falls_back_from_name() {
|
||||
$name = rand_str( 15 );
|
||||
$name = 'baz';
|
||||
|
||||
$term = self::factory()->term->create_and_get(
|
||||
array(
|
||||
@ -156,7 +156,7 @@ class Tests_Term_getTermField extends WP_UnitTestCase {
|
||||
}
|
||||
|
||||
public function test_get_term_field_description() {
|
||||
$desc = wpautop( rand_str() );
|
||||
$desc = wpautop( 'baz' );
|
||||
|
||||
$term = self::factory()->term->create_and_get(
|
||||
array(
|
||||
|
||||
@ -208,7 +208,7 @@ class Tests_Term_SplitSharedTerm extends WP_UnitTestCase {
|
||||
array( '%d' )
|
||||
);
|
||||
|
||||
$menu_id = wp_create_nav_menu( rand_str() );
|
||||
$menu_id = wp_create_nav_menu( 'Nav Menu Bar' );
|
||||
$cat_menu_item = wp_update_nav_menu_item(
|
||||
$menu_id,
|
||||
0,
|
||||
|
||||
@ -260,7 +260,7 @@ class Tests_TermExists extends WP_UnitTestCase {
|
||||
register_taxonomy( 'wptests_tax', 'post' );
|
||||
|
||||
// Insert a term.
|
||||
$term = rand_str();
|
||||
$term = __FUNCTION__;
|
||||
$t = wp_insert_term( $term, 'wptests_tax' );
|
||||
$this->assertIsArray( $t );
|
||||
$this->assertEquals( $t['term_id'], term_exists( $t['term_id'] ) );
|
||||
|
||||
@ -133,9 +133,9 @@ class Tests_Term_WpSetObjectTerms extends WP_UnitTestCase {
|
||||
$ids = self::$post_ids;
|
||||
|
||||
$terms = array(
|
||||
rand_str(),
|
||||
rand_str(),
|
||||
rand_str(),
|
||||
'term0',
|
||||
'term1',
|
||||
'term2',
|
||||
);
|
||||
|
||||
foreach ( $ids as $id ) {
|
||||
@ -164,7 +164,7 @@ class Tests_Term_WpSetObjectTerms extends WP_UnitTestCase {
|
||||
|
||||
public function test_set_object_terms_invalid() {
|
||||
// Bogus taxonomy.
|
||||
$result = wp_set_object_terms( self::$post_ids[0], array( rand_str() ), rand_str() );
|
||||
$result = wp_set_object_terms( self::$post_ids[0], array( 'foo' ), 'invalid-taxonomy' );
|
||||
$this->assertWPError( $result );
|
||||
}
|
||||
|
||||
|
||||
@ -18,7 +18,7 @@ class Tests_WP_Taxonomy extends WP_UnitTestCase {
|
||||
/* @var WP $wp */
|
||||
global $wp;
|
||||
|
||||
$taxonomy = rand_str();
|
||||
$taxonomy = 'taxonomy1';
|
||||
$taxonomy_object = new WP_Taxonomy( $taxonomy, 'post' );
|
||||
|
||||
$taxonomy_object->add_rewrite_rules();
|
||||
@ -31,7 +31,7 @@ class Tests_WP_Taxonomy extends WP_UnitTestCase {
|
||||
/* @var WP $wp */
|
||||
global $wp;
|
||||
|
||||
$taxonomy = rand_str();
|
||||
$taxonomy = 'taxonomy2';
|
||||
$taxonomy_object = new WP_Taxonomy(
|
||||
$taxonomy,
|
||||
'post',
|
||||
@ -58,7 +58,7 @@ class Tests_WP_Taxonomy extends WP_UnitTestCase {
|
||||
/* @var WP_Rewrite $wp_rewrite */
|
||||
global $wp_rewrite;
|
||||
|
||||
$taxonomy = rand_str();
|
||||
$taxonomy = 'taxonomy3';
|
||||
$taxonomy_object = new WP_Taxonomy(
|
||||
$taxonomy,
|
||||
'post',
|
||||
@ -79,7 +79,7 @@ class Tests_WP_Taxonomy extends WP_UnitTestCase {
|
||||
}
|
||||
|
||||
public function test_adds_ajax_callback() {
|
||||
$taxonomy = rand_str();
|
||||
$taxonomy = 'taxonomy4';
|
||||
$taxonomy_object = new WP_Taxonomy(
|
||||
$taxonomy,
|
||||
'post',
|
||||
|
||||
@ -299,7 +299,7 @@ class Tests_Theme extends WP_UnitTestCase {
|
||||
// get_query_template()
|
||||
|
||||
// Template file that doesn't exist.
|
||||
$this->assertSame( '', get_query_template( rand_str() ) );
|
||||
$this->assertSame( '', get_query_template( 'nonexistant' ) );
|
||||
|
||||
// Template files that do exist.
|
||||
/*
|
||||
@ -333,8 +333,8 @@ class Tests_Theme extends WP_UnitTestCase {
|
||||
|
||||
public function test_switch_theme_bogus() {
|
||||
// Try switching to a theme that doesn't exist.
|
||||
$template = rand_str();
|
||||
$style = rand_str();
|
||||
$template = 'some_template';
|
||||
$style = 'some_style';
|
||||
update_option( 'template', $template );
|
||||
update_option( 'stylesheet', $style );
|
||||
|
||||
|
||||
@ -104,7 +104,7 @@ class Tests_User extends WP_UnitTestCase {
|
||||
$this->assertSame( $val, get_user_option( $key, self::$author_id ) );
|
||||
|
||||
// Change and get again.
|
||||
$val2 = rand_str();
|
||||
$val2 = 'baz';
|
||||
update_user_option( self::$author_id, $key, $val2 );
|
||||
$this->assertSame( $val2, get_user_option( $key, self::$author_id ) );
|
||||
}
|
||||
@ -135,7 +135,7 @@ class Tests_User extends WP_UnitTestCase {
|
||||
// Delete by key AND value.
|
||||
update_user_meta( self::$author_id, $key, $val );
|
||||
// Incorrect key: key still exists.
|
||||
delete_user_meta( self::$author_id, $key, rand_str() );
|
||||
delete_user_meta( self::$author_id, $key, 'foo' );
|
||||
$this->assertSame( $val, get_user_meta( self::$author_id, $key, true ) );
|
||||
// Correct key: deleted.
|
||||
delete_user_meta( self::$author_id, $key, $val );
|
||||
@ -149,9 +149,9 @@ class Tests_User extends WP_UnitTestCase {
|
||||
public function test_usermeta_array() {
|
||||
// Some values to set.
|
||||
$vals = array(
|
||||
rand_str() => 'val-' . rand_str(),
|
||||
rand_str() => 'val-' . rand_str(),
|
||||
rand_str() => 'val-' . rand_str(),
|
||||
'key0' => 'val0',
|
||||
'key1' => 'val1',
|
||||
'key2' => 'val2',
|
||||
);
|
||||
|
||||
// There is already some stuff in the array.
|
||||
@ -475,8 +475,8 @@ class Tests_User extends WP_UnitTestCase {
|
||||
$post = array(
|
||||
'post_author' => self::$author_id,
|
||||
'post_status' => 'publish',
|
||||
'post_content' => rand_str(),
|
||||
'post_title' => rand_str(),
|
||||
'post_content' => 'content',
|
||||
'post_title' => 'title',
|
||||
'post_type' => 'post',
|
||||
);
|
||||
|
||||
@ -636,7 +636,7 @@ class Tests_User extends WP_UnitTestCase {
|
||||
public function test_user_meta_error() {
|
||||
$id1 = wp_insert_user(
|
||||
array(
|
||||
'user_login' => rand_str(),
|
||||
'user_login' => 'taco_burrito',
|
||||
'user_pass' => 'password',
|
||||
'user_email' => 'taco@burrito.com',
|
||||
)
|
||||
@ -645,7 +645,7 @@ class Tests_User extends WP_UnitTestCase {
|
||||
|
||||
$id2 = wp_insert_user(
|
||||
array(
|
||||
'user_login' => rand_str(),
|
||||
'user_login' => 'taco_burrito2',
|
||||
'user_pass' => 'password',
|
||||
'user_email' => 'taco@burrito.com',
|
||||
)
|
||||
@ -826,9 +826,9 @@ class Tests_User extends WP_UnitTestCase {
|
||||
*/
|
||||
public function test_wp_insert_user_should_not_wipe_existing_password() {
|
||||
$user_details = array(
|
||||
'user_login' => rand_str(),
|
||||
'user_login' => 'jonsnow',
|
||||
'user_pass' => 'password',
|
||||
'user_email' => rand_str() . '@example.com',
|
||||
'user_email' => 'jonsnow@example.com',
|
||||
);
|
||||
|
||||
$user_id = wp_insert_user( $user_details );
|
||||
|
||||
@ -26,8 +26,8 @@ class Tests_User_Author_Template extends WP_UnitTestCase {
|
||||
array(
|
||||
'post_author' => self::$author_id,
|
||||
'post_status' => 'publish',
|
||||
'post_content' => rand_str(),
|
||||
'post_title' => rand_str(),
|
||||
'post_content' => 'content',
|
||||
'post_title' => 'title',
|
||||
'post_type' => 'post',
|
||||
)
|
||||
);
|
||||
|
||||
@ -16,13 +16,13 @@ class Tests_XMLRPC_wp_editProfile extends WP_XMLRPC_UnitTestCase {
|
||||
$subscriber_id = $this->make_user_by_role( 'subscriber' );
|
||||
|
||||
$new_data = array(
|
||||
'first_name' => rand_str(),
|
||||
'last_name' => rand_str(),
|
||||
'first_name' => 'firstname',
|
||||
'last_name' => 'lastname',
|
||||
'url' => 'http://www.example.org/subscriber',
|
||||
'display_name' => rand_str(),
|
||||
'nickname' => rand_str(),
|
||||
'nicename' => rand_str(),
|
||||
'bio' => rand_str( 200 ),
|
||||
'display_name' => 'displayname',
|
||||
'nickname' => 'nickname',
|
||||
'nicename' => 'nicename',
|
||||
'bio' => 'Lorem ipsum dolor sit amet, consectetur adipiscing elit.',
|
||||
);
|
||||
$result = $this->myxmlrpcserver->wp_editProfile( array( 1, 'subscriber', 'subscriber', $new_data ) );
|
||||
$this->assertNotIXRError( $result );
|
||||
|
||||
@ -18,7 +18,7 @@ class Tests_XMLRPC_wp_getComment extends WP_XMLRPC_UnitTestCase {
|
||||
'comment_author' => 'Test commenter',
|
||||
'comment_author_url' => 'http://example.com/',
|
||||
'comment_author_email' => 'example@example.com',
|
||||
'comment_content' => rand_str( 100 ),
|
||||
'comment_content' => 'Lorem ipsum dolor sit amet, consectetur adipiscing elit.',
|
||||
);
|
||||
self::$parent_comment_id = wp_insert_comment( self::$parent_comment_data );
|
||||
|
||||
@ -28,7 +28,7 @@ class Tests_XMLRPC_wp_getComment extends WP_XMLRPC_UnitTestCase {
|
||||
'comment_author_url' => 'http://example.org/',
|
||||
'comment_author_email' => 'example@example.org',
|
||||
'comment_parent' => self::$parent_comment_id,
|
||||
'comment_content' => rand_str( 100 ),
|
||||
'comment_content' => 'Duis non neque cursus, commodo massa in, bibendum nisl.',
|
||||
);
|
||||
self::$child_comment_id = wp_insert_comment( self::$child_comment_data );
|
||||
}
|
||||
|
||||
@ -14,9 +14,9 @@ class Tests_XMLRPC_wp_getPost extends WP_XMLRPC_UnitTestCase {
|
||||
|
||||
$this->post_date_ts = strtotime( '+1 day' );
|
||||
$this->post_data = array(
|
||||
'post_title' => rand_str(),
|
||||
'post_content' => rand_str( 2000 ),
|
||||
'post_excerpt' => rand_str( 100 ),
|
||||
'post_title' => 'Post Title',
|
||||
'post_content' => 'Lorem ipsum dolor sit amet, consectetur adipiscing elit.',
|
||||
'post_excerpt' => 'Post Excerpt',
|
||||
'post_author' => $this->make_user_by_role( 'author' ),
|
||||
'post_date' => date_format( date_create( "@{$this->post_date_ts}" ), 'Y-m-d H:i:s' ),
|
||||
);
|
||||
|
||||
@ -55,7 +55,7 @@ class Tests_XMLRPC_wp_newComment extends WP_XMLRPC_UnitTestCase {
|
||||
'administrator',
|
||||
self::$posts['publish']->ID,
|
||||
array(
|
||||
'content' => rand_str( 100 ),
|
||||
'content' => 'Content',
|
||||
),
|
||||
)
|
||||
);
|
||||
@ -155,7 +155,7 @@ class Tests_XMLRPC_wp_newComment extends WP_XMLRPC_UnitTestCase {
|
||||
'administrator',
|
||||
$post->ID,
|
||||
array(
|
||||
'content' => rand_str( 100 ),
|
||||
'content' => 'Content',
|
||||
),
|
||||
)
|
||||
);
|
||||
@ -171,7 +171,7 @@ class Tests_XMLRPC_wp_newComment extends WP_XMLRPC_UnitTestCase {
|
||||
'administrator',
|
||||
self::$posts['publish']->ID,
|
||||
array(
|
||||
'content' => rand_str( 100 ),
|
||||
'content' => 'Content',
|
||||
),
|
||||
);
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user