-
diff --git a/tests/phpunit/tests/actions.php b/tests/phpunit/tests/actions.php
index ceacc72d7c..3a620d6a25 100644
|
a
|
b
|
class Tests_Actions extends WP_UnitTestCase { |
| 240 | 240 | $this->assertSame( 1, did_action( $tag1 ) ); |
| 241 | 241 | $this->assertSame( 0, did_action( $tag2 ) ); |
| 242 | 242 | |
| 243 | | // Do action $tag2 a random number of times. |
| 244 | | $count = rand( 0, 10 ); |
| | 243 | // Do action $tag2 10 times. |
| | 244 | $count = 10; |
| 245 | 245 | for ( $i = 0; $i < $count; $i++ ) { |
| 246 | 246 | do_action( $tag2 ); |
| 247 | 247 | } |
-
diff --git a/tests/phpunit/tests/admin/includesPlugin.php b/tests/phpunit/tests/admin/includesPlugin.php
index 7542db6b59..e7ecab1997 100644
|
a
|
b
|
class Tests_Admin_IncludesPlugin extends WP_UnitTestCase { |
| 595 | 595 | */ |
| 596 | 596 | private function _create_plugin( $data = "<?php\n/*\nPlugin Name: Test\n*/", $filename = false, $dir_path = false ) { |
| 597 | 597 | if ( false === $filename ) { |
| 598 | | $filename = rand_str() . '.php'; |
| | 598 | $filename = 'foobar.php'; |
| 599 | 599 | } |
| 600 | 600 | |
| 601 | 601 | if ( false === $dir_path ) { |
-
diff --git a/tests/phpunit/tests/cron.php b/tests/phpunit/tests/cron.php
index 26453c0111..3d1e6d4fe2 100644
|
a
|
b
|
class Tests_Cron extends WP_UnitTestCase { |
| 247 | 247 | */ |
| 248 | 248 | function test_unschedule_hook() { |
| 249 | 249 | $hook = __FUNCTION__; |
| 250 | | $args = array( rand_str() ); |
| | 250 | $args = array( 'foo' ); |
| 251 | 251 | |
| 252 | 252 | // Schedule several events with and without arguments. |
| 253 | 253 | wp_schedule_single_event( strtotime( '+1 hour' ), $hook ); |
-
diff --git a/tests/phpunit/tests/date/xmlrpc.php b/tests/phpunit/tests/date/xmlrpc.php
index 6fe96618bc..a019b667c9 100644
|
a
|
b
|
class Tests_Date_XMLRPC extends WP_XMLRPC_UnitTestCase { |
| 218 | 218 | 'comment_author' => 'Test commenter', |
| 219 | 219 | 'comment_author_url' => 'http://example.com/', |
| 220 | 220 | 'comment_author_email' => 'example@example.com', |
| 221 | | 'comment_content' => rand_str( 100 ), |
| | 221 | 'comment_content' => 'Hello, world!', |
| 222 | 222 | 'comment_approved' => '1', |
| 223 | 223 | ); |
| 224 | 224 | $comment_id = wp_insert_comment( $comment_data ); |
-
diff --git a/tests/phpunit/tests/db/charset.php b/tests/phpunit/tests/db/charset.php
index 98bf43a925..2a7cd3d359 100644
|
a
|
b
|
class Tests_DB_Charset extends WP_UnitTestCase { |
| 1071 | 1071 | * @covers wpdb::strip_invalid_text_from_query |
| 1072 | 1072 | */ |
| 1073 | 1073 | function test_strip_invalid_text_from_query_cp1251_is_safe() { |
| 1074 | | $tablename = 'test_cp1251_query_' . rand_str( 5 ); |
| | 1074 | $tablename = 'test_cp1251_query_table'; |
| 1075 | 1075 | if ( ! self::$_wpdb->query( "CREATE TABLE $tablename ( a VARCHAR(50) ) DEFAULT CHARSET 'cp1251'" ) ) { |
| 1076 | 1076 | $this->markTestSkipped( "Test requires the 'cp1251' charset." ); |
| 1077 | 1077 | } |
| … |
… |
class Tests_DB_Charset extends WP_UnitTestCase { |
| 1090 | 1090 | * @covers wpdb::strip_invalid_text_from_query |
| 1091 | 1091 | */ |
| 1092 | 1092 | function test_no_db_charset_defined() { |
| 1093 | | $tablename = 'test_cp1251_query_' . rand_str( 5 ); |
| | 1093 | $tablename = 'test_cp1251_query_table'; |
| 1094 | 1094 | if ( ! self::$_wpdb->query( "CREATE TABLE $tablename ( a VARCHAR(50) ) DEFAULT CHARSET 'cp1251'" ) ) { |
| 1095 | 1095 | $this->markTestSkipped( "Test requires the 'cp1251' charset." ); |
| 1096 | 1096 | } |
-
diff --git a/tests/phpunit/tests/file.php b/tests/phpunit/tests/file.php
index 04fd32ff82..ec71719259 100644
|
a
|
b
|
class Tests_File extends WP_UnitTestCase { |
| 97 | 97 | } |
| 98 | 98 | |
| 99 | 99 | // Write some random contents. |
| 100 | | $c = rand_str(); |
| | 100 | $c = 'foobar'; |
| 101 | 101 | fwrite( $fp, $c ); |
| 102 | 102 | fclose( $fp ); |
| 103 | 103 | |
-
diff --git a/tests/phpunit/tests/hooks/addFilter.php b/tests/phpunit/tests/hooks/addFilter.php
index 5890f22044..593ba509b8 100644
|
a
|
b
|
class Tests_Hooks_AddFilter extends WP_UnitTestCase { |
| 15 | 15 | $callback = '__return_null'; |
| 16 | 16 | $hook = new WP_Hook(); |
| 17 | 17 | $tag = __FUNCTION__; |
| 18 | | $priority = rand( 1, 100 ); |
| 19 | | $accepted_args = rand( 1, 100 ); |
| | 18 | $priority = 1; |
| | 19 | $accepted_args = 2; |
| 20 | 20 | |
| 21 | 21 | $hook->add_filter( $tag, $callback, $priority, $accepted_args ); |
| 22 | 22 | |
| … |
… |
class Tests_Hooks_AddFilter extends WP_UnitTestCase { |
| 30 | 30 | $callback = array( $a, 'action' ); |
| 31 | 31 | $hook = new WP_Hook(); |
| 32 | 32 | $tag = __FUNCTION__; |
| 33 | | $priority = rand( 1, 100 ); |
| 34 | | $accepted_args = rand( 1, 100 ); |
| | 33 | $priority = 1; |
| | 34 | $accepted_args = 2; |
| 35 | 35 | |
| 36 | 36 | $hook->add_filter( $tag, $callback, $priority, $accepted_args ); |
| 37 | 37 | |
| … |
… |
class Tests_Hooks_AddFilter extends WP_UnitTestCase { |
| 44 | 44 | $callback = array( 'MockAction', 'action' ); |
| 45 | 45 | $hook = new WP_Hook(); |
| 46 | 46 | $tag = __FUNCTION__; |
| 47 | | $priority = rand( 1, 100 ); |
| 48 | | $accepted_args = rand( 1, 100 ); |
| | 47 | $priority = 1; |
| | 48 | $accepted_args = 2; |
| 49 | 49 | |
| 50 | 50 | $hook->add_filter( $tag, $callback, $priority, $accepted_args ); |
| 51 | 51 | |
| … |
… |
class Tests_Hooks_AddFilter extends WP_UnitTestCase { |
| 59 | 59 | $callback_two = '__return_false'; |
| 60 | 60 | $hook = new WP_Hook(); |
| 61 | 61 | $tag = __FUNCTION__; |
| 62 | | $priority = rand( 1, 100 ); |
| 63 | | $accepted_args = rand( 1, 100 ); |
| | 62 | $priority = 1; |
| | 63 | $accepted_args = 2; |
| 64 | 64 | |
| 65 | 65 | $hook->add_filter( $tag, $callback_one, $priority, $accepted_args ); |
| 66 | 66 | $this->assertCount( 1, $hook->callbacks[ $priority ] ); |
| … |
… |
class Tests_Hooks_AddFilter extends WP_UnitTestCase { |
| 74 | 74 | $callback_two = '__return_false'; |
| 75 | 75 | $hook = new WP_Hook(); |
| 76 | 76 | $tag = __FUNCTION__; |
| 77 | | $priority = rand( 1, 100 ); |
| 78 | | $accepted_args = rand( 1, 100 ); |
| | 77 | $priority = 1; |
| | 78 | $accepted_args = 2; |
| 79 | 79 | |
| 80 | 80 | $hook->add_filter( $tag, $callback_one, $priority, $accepted_args ); |
| 81 | 81 | $this->assertCount( 1, $hook->callbacks[ $priority ] ); |
| … |
… |
class Tests_Hooks_AddFilter extends WP_UnitTestCase { |
| 89 | 89 | $callback = '__return_null'; |
| 90 | 90 | $hook = new WP_Hook(); |
| 91 | 91 | $tag = __FUNCTION__; |
| 92 | | $priority = rand( 1, 100 ); |
| 93 | | $accepted_args = rand( 1, 100 ); |
| | 92 | $priority = 1; |
| | 93 | $accepted_args = 2; |
| 94 | 94 | |
| 95 | 95 | $hook->add_filter( $tag, $callback, $priority, $accepted_args ); |
| 96 | 96 | $this->assertCount( 1, $hook->callbacks[ $priority ] ); |
| … |
… |
class Tests_Hooks_AddFilter extends WP_UnitTestCase { |
| 103 | 103 | $callback = '__return_null'; |
| 104 | 104 | $hook = new WP_Hook(); |
| 105 | 105 | $tag = __FUNCTION__; |
| 106 | | $priority = rand( 1, 100 ); |
| 107 | | $accepted_args = rand( 1, 100 ); |
| | 106 | $priority = 1; |
| | 107 | $accepted_args = 2; |
| 108 | 108 | |
| 109 | 109 | $hook->add_filter( $tag, $callback, $priority, $accepted_args ); |
| 110 | 110 | $this->assertCount( 1, $hook->callbacks[ $priority ] ); |
-
diff --git a/tests/phpunit/tests/hooks/applyFilters.php b/tests/phpunit/tests/hooks/applyFilters.php
index fcb8e3b126..388f85c5c2 100644
|
a
|
b
|
class Tests_Hooks_ApplyFilters extends WP_UnitTestCase { |
| 13 | 13 | $callback = array( $a, 'filter' ); |
| 14 | 14 | $hook = new WP_Hook(); |
| 15 | 15 | $tag = __FUNCTION__; |
| 16 | | $priority = rand( 1, 100 ); |
| 17 | | $accepted_args = rand( 1, 100 ); |
| | 16 | $priority = 1; |
| | 17 | $accepted_args = 2; |
| 18 | 18 | $arg = __FUNCTION__ . '_arg'; |
| 19 | 19 | |
| 20 | 20 | $hook->add_filter( $tag, $callback, $priority, $accepted_args ); |
| … |
… |
class Tests_Hooks_ApplyFilters extends WP_UnitTestCase { |
| 30 | 30 | $callback = array( $a, 'filter' ); |
| 31 | 31 | $hook = new WP_Hook(); |
| 32 | 32 | $tag = __FUNCTION__; |
| 33 | | $priority = rand( 1, 100 ); |
| 34 | | $accepted_args = rand( 1, 100 ); |
| | 33 | $priority = 1; |
| | 34 | $accepted_args = 2; |
| 35 | 35 | $arg = __FUNCTION__ . '_arg'; |
| 36 | 36 | |
| 37 | 37 | $hook->add_filter( $tag, $callback, $priority, $accepted_args ); |
-
diff --git a/tests/phpunit/tests/hooks/doAction.php b/tests/phpunit/tests/hooks/doAction.php
index 0fb5652f3b..5ac1d4d4b9 100644
|
a
|
b
|
class Tests_Hooks_DoAction extends WP_UnitTestCase { |
| 21 | 21 | $callback = array( $a, 'action' ); |
| 22 | 22 | $hook = new WP_Hook(); |
| 23 | 23 | $tag = __FUNCTION__; |
| 24 | | $priority = rand( 1, 100 ); |
| 25 | | $accepted_args = rand( 1, 100 ); |
| | 24 | $priority = 1; |
| | 25 | $accepted_args = 2; |
| 26 | 26 | $arg = __FUNCTION__ . '_arg'; |
| 27 | 27 | |
| 28 | 28 | $hook->add_filter( $tag, $callback, $priority, $accepted_args ); |
| … |
… |
class Tests_Hooks_DoAction extends WP_UnitTestCase { |
| 36 | 36 | $callback = array( $a, 'filter' ); |
| 37 | 37 | $hook = new WP_Hook(); |
| 38 | 38 | $tag = __FUNCTION__; |
| 39 | | $priority = rand( 1, 100 ); |
| 40 | | $accepted_args = rand( 1, 100 ); |
| | 39 | $priority = 1; |
| | 40 | $accepted_args = 2; |
| 41 | 41 | $arg = __FUNCTION__ . '_arg'; |
| 42 | 42 | |
| 43 | 43 | $hook->add_filter( $tag, $callback, $priority, $accepted_args ); |
| … |
… |
class Tests_Hooks_DoAction extends WP_UnitTestCase { |
| 54 | 54 | $callback_two = array( $b, 'filter' ); |
| 55 | 55 | $hook = new WP_Hook(); |
| 56 | 56 | $tag = __FUNCTION__; |
| 57 | | $priority = rand( 1, 100 ); |
| 58 | | $accepted_args = rand( 1, 100 ); |
| | 57 | $priority = 1; |
| | 58 | $accepted_args = 2; |
| 59 | 59 | $arg = __FUNCTION__ . '_arg'; |
| 60 | 60 | |
| 61 | 61 | $hook->add_filter( $tag, $callback_one, $priority, $accepted_args ); |
| … |
… |
class Tests_Hooks_DoAction extends WP_UnitTestCase { |
| 73 | 73 | $callback_two = array( $b, 'filter' ); |
| 74 | 74 | $hook = new WP_Hook(); |
| 75 | 75 | $tag = __FUNCTION__; |
| 76 | | $priority = rand( 1, 100 ); |
| 77 | | $accepted_args = rand( 1, 100 ); |
| | 76 | $priority = 1; |
| | 77 | $accepted_args = 2; |
| 78 | 78 | $arg = __FUNCTION__ . '_arg'; |
| 79 | 79 | |
| 80 | 80 | $hook->add_filter( $tag, $callback_one, $priority, $accepted_args ); |
| … |
… |
class Tests_Hooks_DoAction extends WP_UnitTestCase { |
| 89 | 89 | $callback = array( $this, '_action_callback' ); |
| 90 | 90 | $hook = new WP_Hook(); |
| 91 | 91 | $tag = __FUNCTION__; |
| 92 | | $priority = rand( 1, 100 ); |
| | 92 | $priority = 1; |
| 93 | 93 | $accepted_args = 0; |
| 94 | 94 | $arg = __FUNCTION__ . '_arg'; |
| 95 | 95 | |
| … |
… |
class Tests_Hooks_DoAction extends WP_UnitTestCase { |
| 103 | 103 | $callback = array( $this, '_action_callback' ); |
| 104 | 104 | $hook = new WP_Hook(); |
| 105 | 105 | $tag = __FUNCTION__; |
| 106 | | $priority = rand( 1, 100 ); |
| | 106 | $priority = 1; |
| 107 | 107 | $accepted_args = 1; |
| 108 | 108 | $arg = __FUNCTION__ . '_arg'; |
| 109 | 109 | |
| … |
… |
class Tests_Hooks_DoAction extends WP_UnitTestCase { |
| 117 | 117 | $callback = array( $this, '_action_callback' ); |
| 118 | 118 | $hook = new WP_Hook(); |
| 119 | 119 | $tag = __FUNCTION__; |
| 120 | | $priority = rand( 1, 100 ); |
| | 120 | $priority = 100; |
| 121 | 121 | $accepted_args = 1000; |
| 122 | 122 | $arg = __FUNCTION__ . '_arg'; |
| 123 | 123 | |
-
diff --git a/tests/phpunit/tests/hooks/doAllHook.php b/tests/phpunit/tests/hooks/doAllHook.php
index 29eec96428..776c3e4576 100644
|
a
|
b
|
class Tests_Hooks_DoAllHook extends WP_UnitTestCase { |
| 13 | 13 | $callback = array( $a, 'action' ); |
| 14 | 14 | $hook = new WP_Hook(); |
| 15 | 15 | $tag = 'all'; |
| 16 | | $priority = rand( 1, 100 ); |
| 17 | | $accepted_args = rand( 1, 100 ); |
| | 16 | $priority = 1; |
| | 17 | $accepted_args = 2; |
| 18 | 18 | $arg = 'all_arg'; |
| 19 | 19 | |
| 20 | 20 | $hook->add_filter( $tag, $callback, $priority, $accepted_args ); |
-
diff --git a/tests/phpunit/tests/hooks/hasFilter.php b/tests/phpunit/tests/hooks/hasFilter.php
index f9d48b3d4e..f6dde3a0f8 100644
|
a
|
b
|
class Tests_Hooks_HasFilter extends WP_UnitTestCase { |
| 12 | 12 | $callback = '__return_null'; |
| 13 | 13 | $hook = new WP_Hook(); |
| 14 | 14 | $tag = __FUNCTION__; |
| 15 | | $priority = rand( 1, 100 ); |
| 16 | | $accepted_args = rand( 1, 100 ); |
| | 15 | $priority = 1; |
| | 16 | $accepted_args = 2; |
| 17 | 17 | |
| 18 | 18 | $hook->add_filter( $tag, $callback, $priority, $accepted_args ); |
| 19 | 19 | |
| … |
… |
class Tests_Hooks_HasFilter extends WP_UnitTestCase { |
| 25 | 25 | $callback = array( $a, 'action' ); |
| 26 | 26 | $hook = new WP_Hook(); |
| 27 | 27 | $tag = __FUNCTION__; |
| 28 | | $priority = rand( 1, 100 ); |
| 29 | | $accepted_args = rand( 1, 100 ); |
| | 28 | $priority = 1; |
| | 29 | $accepted_args = 2; |
| 30 | 30 | |
| 31 | 31 | $hook->add_filter( $tag, $callback, $priority, $accepted_args ); |
| 32 | 32 | |
| … |
… |
class Tests_Hooks_HasFilter extends WP_UnitTestCase { |
| 37 | 37 | $callback = array( 'MockAction', 'action' ); |
| 38 | 38 | $hook = new WP_Hook(); |
| 39 | 39 | $tag = __FUNCTION__; |
| 40 | | $priority = rand( 1, 100 ); |
| 41 | | $accepted_args = rand( 1, 100 ); |
| | 40 | $priority = 1; |
| | 41 | $accepted_args = 2; |
| 42 | 42 | |
| 43 | 43 | $hook->add_filter( $tag, $callback, $priority, $accepted_args ); |
| 44 | 44 | |
| … |
… |
class Tests_Hooks_HasFilter extends WP_UnitTestCase { |
| 49 | 49 | $callback = '__return_null'; |
| 50 | 50 | $hook = new WP_Hook(); |
| 51 | 51 | $tag = __FUNCTION__; |
| 52 | | $priority = rand( 1, 100 ); |
| 53 | | $accepted_args = rand( 1, 100 ); |
| | 52 | $priority = 1; |
| | 53 | $accepted_args = 2; |
| 54 | 54 | |
| 55 | 55 | $hook->add_filter( $tag, $callback, $priority, $accepted_args ); |
| 56 | 56 | |
| … |
… |
class Tests_Hooks_HasFilter extends WP_UnitTestCase { |
| 74 | 74 | $callback = '__return_null'; |
| 75 | 75 | $hook = new WP_Hook(); |
| 76 | 76 | $tag = __FUNCTION__; |
| 77 | | $priority = rand( 1, 100 ); |
| 78 | | $accepted_args = rand( 1, 100 ); |
| | 77 | $priority = 1; |
| | 78 | $accepted_args = 2; |
| 79 | 79 | |
| 80 | 80 | $hook->add_filter( $tag, $callback, $priority, $accepted_args ); |
| 81 | 81 | |
-
diff --git a/tests/phpunit/tests/hooks/hasFilters.php b/tests/phpunit/tests/hooks/hasFilters.php
index f5c1e657fc..068ec88e52 100644
|
a
|
b
|
class Tests_Hooks_HasFilters extends WP_UnitTestCase { |
| 12 | 12 | $callback = '__return_null'; |
| 13 | 13 | $hook = new WP_Hook(); |
| 14 | 14 | $tag = __FUNCTION__; |
| 15 | | $priority = rand( 1, 100 ); |
| 16 | | $accepted_args = rand( 1, 100 ); |
| | 15 | $priority = 1; |
| | 16 | $accepted_args = 2; |
| 17 | 17 | |
| 18 | 18 | $hook->add_filter( $tag, $callback, $priority, $accepted_args ); |
| 19 | 19 | |
| … |
… |
class Tests_Hooks_HasFilters extends WP_UnitTestCase { |
| 29 | 29 | $callback = '__return_null'; |
| 30 | 30 | $hook = new WP_Hook(); |
| 31 | 31 | $tag = __FUNCTION__; |
| 32 | | $priority = rand( 1, 100 ); |
| 33 | | $accepted_args = rand( 1, 100 ); |
| | 32 | $priority = 1; |
| | 33 | $accepted_args = 2; |
| 34 | 34 | |
| 35 | 35 | $hook->add_filter( $tag, $callback, $priority, $accepted_args ); |
| 36 | 36 | $hook->remove_filter( $tag, $callback, $priority ); |
| … |
… |
class Tests_Hooks_HasFilters extends WP_UnitTestCase { |
| 41 | 41 | $callback = '__return_null'; |
| 42 | 42 | $hook = new WP_Hook(); |
| 43 | 43 | $tag = __FUNCTION__; |
| 44 | | $priority = rand( 1, 100 ); |
| 45 | | $accepted_args = rand( 1, 100 ); |
| | 44 | $priority = 1; |
| | 45 | $accepted_args = 2; |
| 46 | 46 | |
| 47 | 47 | $hook->add_filter( $tag, $callback, $priority, $accepted_args ); |
| 48 | 48 | $function_key = _wp_filter_build_unique_id( $tag, $callback, $priority ); |
-
diff --git a/tests/phpunit/tests/hooks/iterator.php b/tests/phpunit/tests/hooks/iterator.php
index 4840aa3d4d..0bfdcab36b 100644
|
a
|
b
|
class Tests_Hooks_Iterator extends WP_UnitTestCase { |
| 13 | 13 | $callback_two = '__return_false'; |
| 14 | 14 | $hook = new WP_Hook(); |
| 15 | 15 | $tag = __FUNCTION__; |
| 16 | | $priority = rand( 1, 100 ); |
| 17 | | $accepted_args = rand( 1, 100 ); |
| | 16 | $priority = 1; |
| | 17 | $accepted_args = 2; |
| 18 | 18 | |
| 19 | 19 | $hook->add_filter( $tag, $callback_one, $priority, $accepted_args ); |
| 20 | 20 | $hook->add_filter( $tag, $callback_two, $priority + 1, $accepted_args ); |
-
diff --git a/tests/phpunit/tests/hooks/preinitHooks.php b/tests/phpunit/tests/hooks/preinitHooks.php
index 551d64400f..18afaf6992 100644
|
a
|
b
|
class Tests_Hooks_PreinitHooks extends WP_UnitTestCase { |
| 10 | 10 | |
| 11 | 11 | public function test_array_to_hooks() { |
| 12 | 12 | $tag1 = __FUNCTION__ . '_1'; |
| 13 | | $priority1 = rand( 1, 100 ); |
| | 13 | $priority1 = 1; |
| 14 | 14 | $tag2 = __FUNCTION__ . '_2'; |
| 15 | | $priority2 = rand( 1, 100 ); |
| | 15 | $priority2 = 2; |
| 16 | 16 | $filters = array( |
| 17 | 17 | $tag1 => array( |
| 18 | 18 | $priority1 => array( |
-
diff --git a/tests/phpunit/tests/hooks/removeAllFilters.php b/tests/phpunit/tests/hooks/removeAllFilters.php
index cfaf81f4c8..90b8a06cda 100644
|
a
|
b
|
class Tests_Hooks_RemoveAllFilters extends WP_UnitTestCase { |
| 12 | 12 | $callback = '__return_null'; |
| 13 | 13 | $hook = new WP_Hook(); |
| 14 | 14 | $tag = __FUNCTION__; |
| 15 | | $priority = rand( 1, 100 ); |
| 16 | | $accepted_args = rand( 1, 100 ); |
| | 15 | $priority = 1; |
| | 16 | $accepted_args = 2; |
| 17 | 17 | |
| 18 | 18 | $hook->add_filter( $tag, $callback, $priority, $accepted_args ); |
| 19 | 19 | |
| … |
… |
class Tests_Hooks_RemoveAllFilters extends WP_UnitTestCase { |
| 27 | 27 | $callback_two = '__return_false'; |
| 28 | 28 | $hook = new WP_Hook(); |
| 29 | 29 | $tag = __FUNCTION__; |
| 30 | | $priority = rand( 1, 100 ); |
| 31 | | $accepted_args = rand( 1, 100 ); |
| | 30 | $priority = 1; |
| | 31 | $accepted_args = 2; |
| 32 | 32 | |
| 33 | 33 | $hook->add_filter( $tag, $callback_one, $priority, $accepted_args ); |
| 34 | 34 | $hook->add_filter( $tag, $callback_two, $priority + 1, $accepted_args ); |
-
diff --git a/tests/phpunit/tests/hooks/removeFilter.php b/tests/phpunit/tests/hooks/removeFilter.php
index 793cd02b3c..adf8b6ad75 100644
|
a
|
b
|
class Tests_Hooks_RemoveFilter extends WP_UnitTestCase { |
| 12 | 12 | $callback = '__return_null'; |
| 13 | 13 | $hook = new WP_Hook(); |
| 14 | 14 | $tag = __FUNCTION__; |
| 15 | | $priority = rand( 1, 100 ); |
| 16 | | $accepted_args = rand( 1, 100 ); |
| | 15 | $priority = 1; |
| | 16 | $accepted_args = 2; |
| 17 | 17 | |
| 18 | 18 | $hook->add_filter( $tag, $callback, $priority, $accepted_args ); |
| 19 | 19 | $hook->remove_filter( $tag, $callback, $priority ); |
| … |
… |
class Tests_Hooks_RemoveFilter extends WP_UnitTestCase { |
| 26 | 26 | $callback = array( $a, 'action' ); |
| 27 | 27 | $hook = new WP_Hook(); |
| 28 | 28 | $tag = __FUNCTION__; |
| 29 | | $priority = rand( 1, 100 ); |
| 30 | | $accepted_args = rand( 1, 100 ); |
| | 29 | $priority = 1; |
| | 30 | $accepted_args = 2; |
| 31 | 31 | |
| 32 | 32 | $hook->add_filter( $tag, $callback, $priority, $accepted_args ); |
| 33 | 33 | $hook->remove_filter( $tag, $callback, $priority ); |
| … |
… |
class Tests_Hooks_RemoveFilter extends WP_UnitTestCase { |
| 39 | 39 | $callback = array( 'MockAction', 'action' ); |
| 40 | 40 | $hook = new WP_Hook(); |
| 41 | 41 | $tag = __FUNCTION__; |
| 42 | | $priority = rand( 1, 100 ); |
| 43 | | $accepted_args = rand( 1, 100 ); |
| | 42 | $priority = 1; |
| | 43 | $accepted_args = 2; |
| 44 | 44 | |
| 45 | 45 | $hook->add_filter( $tag, $callback, $priority, $accepted_args ); |
| 46 | 46 | $hook->remove_filter( $tag, $callback, $priority ); |
| … |
… |
class Tests_Hooks_RemoveFilter extends WP_UnitTestCase { |
| 53 | 53 | $callback_two = '__return_false'; |
| 54 | 54 | $hook = new WP_Hook(); |
| 55 | 55 | $tag = __FUNCTION__; |
| 56 | | $priority = rand( 1, 100 ); |
| 57 | | $accepted_args = rand( 1, 100 ); |
| | 56 | $priority = 1; |
| | 57 | $accepted_args = 2; |
| 58 | 58 | |
| 59 | 59 | $hook->add_filter( $tag, $callback_one, $priority, $accepted_args ); |
| 60 | 60 | $hook->add_filter( $tag, $callback_two, $priority, $accepted_args ); |
| … |
… |
class Tests_Hooks_RemoveFilter extends WP_UnitTestCase { |
| 69 | 69 | $callback_two = '__return_false'; |
| 70 | 70 | $hook = new WP_Hook(); |
| 71 | 71 | $tag = __FUNCTION__; |
| 72 | | $priority = rand( 1, 100 ); |
| 73 | | $accepted_args = rand( 1, 100 ); |
| | 72 | $priority = 1; |
| | 73 | $accepted_args = 2; |
| 74 | 74 | |
| 75 | 75 | $hook->add_filter( $tag, $callback_one, $priority, $accepted_args ); |
| 76 | 76 | $hook->add_filter( $tag, $callback_two, $priority + 1, $accepted_args ); |
-
diff --git a/tests/phpunit/tests/image/intermediateSize.php b/tests/phpunit/tests/image/intermediateSize.php
index cf5b3888fe..3efb872457 100644
|
a
|
b
|
class Tests_Image_Intermediate_Size extends WP_UnitTestCase { |
| 182 | 182 | */ |
| 183 | 183 | function test_get_intermediate_sizes_by_array_zero_height() { |
| 184 | 184 | // Generate random width. |
| 185 | | $random_w = rand( 300, 400 ); |
| | 185 | $random_w = 300; |
| 186 | 186 | |
| 187 | 187 | // Only one dimention match shouldn't return false positive (see: #17626). |
| 188 | 188 | add_image_size( 'test-size', $random_w, 0, false ); |
-
diff --git a/tests/phpunit/tests/media.php b/tests/phpunit/tests/media.php
index 79cc067712..96b1a159f2 100644
|
a
|
b
|
EOF; |
| 1636 | 1636 | $size_array = $this->_get_image_size_array_from_meta( $image_meta, 'medium' ); |
| 1637 | 1637 | |
| 1638 | 1638 | // Copy hash generation method used in wp_save_image(). |
| 1639 | | $hash = 'e' . time() . rand( 100, 999 ); |
| | 1639 | $hash = 'e' . time() . 100; |
| 1640 | 1640 | |
| 1641 | 1641 | $filename_base = wp_basename( self::$large_filename, '.jpg' ); |
| 1642 | 1642 | $filename_hash = "{$filename_base}-{$hash}"; |
-
diff --git a/tests/phpunit/tests/option/networkOption.php b/tests/phpunit/tests/option/networkOption.php
index bf2e27504c..6af77dc6fa 100644
|
a
|
b
|
class Tests_Option_NetworkOption extends WP_UnitTestCase { |
| 85 | 85 | * @param $expected_response |
| 86 | 86 | */ |
| 87 | 87 | function test_add_network_option_network_id_parameter( $network_id, $expected_response ) { |
| 88 | | $option = rand_str(); |
| 89 | | $value = rand_str(); |
| | 88 | $option = 'foo'; |
| | 89 | $value = 'bar'; |
| 90 | 90 | |
| 91 | 91 | $this->assertSame( $expected_response, add_network_option( $network_id, $option, $value ) ); |
| 92 | 92 | } |
| … |
… |
class Tests_Option_NetworkOption extends WP_UnitTestCase { |
| 98 | 98 | * @param $expected_response |
| 99 | 99 | */ |
| 100 | 100 | function test_get_network_option_network_id_parameter( $network_id, $expected_response ) { |
| 101 | | $option = rand_str(); |
| | 101 | $option = 'baz'; |
| 102 | 102 | |
| 103 | 103 | $this->assertSame( $expected_response, get_network_option( $network_id, $option, true ) ); |
| 104 | 104 | } |
-
diff --git a/tests/phpunit/tests/option/transient.php b/tests/phpunit/tests/option/transient.php
index 58dd8c2107..8e80b7fec0 100644
|
a
|
b
|
class Tests_Option_Transient extends WP_UnitTestCase { |
| 30 | 30 | } |
| 31 | 31 | |
| 32 | 32 | function test_serialized_data() { |
| 33 | | $key = rand_str(); |
| | 33 | $key = __FUNCTION__; |
| 34 | 34 | $value = array( |
| 35 | 35 | 'foo' => true, |
| 36 | 36 | 'bar' => true, |
| … |
… |
class Tests_Option_Transient extends WP_UnitTestCase { |
| 49 | 49 | * @ticket 22807 |
| 50 | 50 | */ |
| 51 | 51 | function test_transient_data_with_timeout() { |
| 52 | | $key = rand_str(); |
| 53 | | $value = rand_str(); |
| | 52 | $key = __FUNCTION__; |
| | 53 | $value = 'foobar'; |
| 54 | 54 | |
| 55 | 55 | $this->assertFalse( get_option( '_transient_timeout_' . $key ) ); |
| 56 | 56 | $now = time(); |
| … |
… |
class Tests_Option_Transient extends WP_UnitTestCase { |
| 70 | 70 | * @ticket 22807 |
| 71 | 71 | */ |
| 72 | 72 | function test_transient_add_timeout() { |
| 73 | | $key = rand_str(); |
| 74 | | $value = rand_str(); |
| 75 | | $value2 = rand_str(); |
| | 73 | $key = __FUNCTION__; |
| | 74 | $value = 'foo'; |
| | 75 | $value2 = 'bar'; |
| 76 | 76 | $this->assertTrue( set_transient( $key, $value ) ); |
| 77 | 77 | $this->assertSame( $value, get_transient( $key ) ); |
| 78 | 78 | |
-
diff --git a/tests/phpunit/tests/post.php b/tests/phpunit/tests/post.php
index 16890f91c3..f05d46be0e 100644
|
a
|
b
|
class Tests_Post extends WP_UnitTestCase { |
| 68 | 68 | $post = array( |
| 69 | 69 | 'post_author' => self::$editor_id, |
| 70 | 70 | 'post_status' => 'publish', |
| 71 | | 'post_content' => rand_str(), |
| 72 | | 'post_title' => rand_str(), |
| | 71 | 'post_content' => "{$post_type}_content", |
| | 72 | 'post_title' => "{$post_type}_title", |
| 73 | 73 | 'tax_input' => array( |
| 74 | 74 | 'post_tag' => 'tag1,tag2', |
| 75 | 75 | 'ctax' => 'cterm1,cterm2', |
| … |
… |
class Tests_Post extends WP_UnitTestCase { |
| 126 | 126 | $post = array( |
| 127 | 127 | 'post_author' => self::$editor_id, |
| 128 | 128 | 'post_status' => 'publish', |
| 129 | | 'post_content' => rand_str(), |
| 130 | | 'post_title' => rand_str(), |
| | 129 | 'post_content' => 'content', |
| | 130 | 'post_title' => 'title', |
| 131 | 131 | 'post_date' => date_format( date_create( "@{$future_date}" ), 'Y-m-d H:i:s' ), |
| 132 | 132 | ); |
| 133 | 133 | |
| … |
… |
class Tests_Post extends WP_UnitTestCase { |
| 162 | 162 | $post = array( |
| 163 | 163 | 'post_author' => self::$editor_id, |
| 164 | 164 | 'post_status' => 'publish', |
| 165 | | 'post_content' => rand_str(), |
| 166 | | 'post_title' => rand_str(), |
| | 165 | 'post_content' => 'content', |
| | 166 | 'post_title' => 'title', |
| 167 | 167 | 'post_date' => date_format( date_create( "@{$future_date_1}" ), 'Y-m-d H:i:s' ), |
| 168 | 168 | ); |
| 169 | 169 | |
| … |
… |
class Tests_Post extends WP_UnitTestCase { |
| 207 | 207 | $post = array( |
| 208 | 208 | 'post_author' => self::$editor_id, |
| 209 | 209 | 'post_status' => 'publish', |
| 210 | | 'post_content' => rand_str(), |
| 211 | | 'post_title' => rand_str(), |
| | 210 | 'post_content' => 'content', |
| | 211 | 'post_title' => 'title', |
| 212 | 212 | 'post_date' => date_format( date_create( "@{$future_date_1}" ), 'Y-m-d H:i:s' ), |
| 213 | 213 | ); |
| 214 | 214 | |
| … |
… |
class Tests_Post extends WP_UnitTestCase { |
| 249 | 249 | $post = array( |
| 250 | 250 | 'post_author' => self::$editor_id, |
| 251 | 251 | 'post_status' => 'draft', |
| 252 | | 'post_content' => rand_str(), |
| 253 | | 'post_title' => rand_str(), |
| | 252 | 'post_content' => 'content', |
| | 253 | 'post_title' => 'title', |
| 254 | 254 | 'post_date' => date_format( date_create( "@{$future_date}" ), 'Y-m-d H:i:s' ), |
| 255 | 255 | ); |
| 256 | 256 | |
| … |
… |
class Tests_Post extends WP_UnitTestCase { |
| 284 | 284 | $post = array( |
| 285 | 285 | 'post_author' => self::$editor_id, |
| 286 | 286 | 'post_status' => 'publish', |
| 287 | | 'post_content' => rand_str(), |
| 288 | | 'post_title' => rand_str(), |
| | 287 | 'post_content' => 'content', |
| | 288 | 'post_title' => 'title', |
| 289 | 289 | 'post_date' => date_format( date_create( "@{$future_date_1}" ), 'Y-m-d H:i:s' ), |
| 290 | 290 | ); |
| 291 | 291 | |
| … |
… |
class Tests_Post extends WP_UnitTestCase { |
| 328 | 328 | $post = array( |
| 329 | 329 | 'post_author' => self::$editor_id, |
| 330 | 330 | 'post_status' => 'publish', |
| 331 | | 'post_content' => rand_str(), |
| 332 | | 'post_title' => rand_str(), |
| | 331 | 'post_content' => "{$status}_content", |
| | 332 | 'post_title' => "{$status}_title", |
| 333 | 333 | 'post_date' => date_format( date_create( "@{$future_date_1}" ), 'Y-m-d H:i:s' ), |
| 334 | 334 | ); |
| 335 | 335 | |
| … |
… |
class Tests_Post extends WP_UnitTestCase { |
| 370 | 370 | $post = array( |
| 371 | 371 | 'post_author' => self::$editor_id, |
| 372 | 372 | 'post_status' => 'private', |
| 373 | | 'post_content' => rand_str(), |
| 374 | | 'post_title' => rand_str(), |
| | 373 | 'post_content' => 'content', |
| | 374 | 'post_title' => 'title', |
| 375 | 375 | 'post_date' => date_format( date_create( "@{$future_date}" ), 'Y-m-d H:i:s' ), |
| 376 | 376 | ); |
| 377 | 377 | |
| … |
… |
class Tests_Post extends WP_UnitTestCase { |
| 404 | 404 | $post = array( |
| 405 | 405 | 'post_author' => self::$editor_id, |
| 406 | 406 | 'post_status' => 'publish', |
| 407 | | 'post_content' => rand_str(), |
| 408 | | 'post_title' => rand_str(), |
| | 407 | 'post_content' => 'content', |
| | 408 | 'post_title' => 'title', |
| 409 | 409 | 'post_date' => '2012-02-30 00:00:00', |
| 410 | 410 | ); |
| 411 | 411 | |
| … |
… |
class Tests_Post extends WP_UnitTestCase { |
| 427 | 427 | $post = array( |
| 428 | 428 | 'post_author' => self::$editor_id, |
| 429 | 429 | 'post_status' => 'publish', |
| 430 | | 'post_content' => rand_str(), |
| 431 | | 'post_title' => rand_str(), |
| | 430 | 'post_content' => 'content', |
| | 431 | 'post_title' => 'title', |
| 432 | 432 | 'post_date' => date_format( date_create( "@{$future_date_1}" ), 'Y-m-d H:i:s' ), |
| 433 | 433 | ); |
| 434 | 434 | |
| … |
… |
class Tests_Post extends WP_UnitTestCase { |
| 533 | 533 | $post = array( |
| 534 | 534 | 'post_author' => self::$editor_id, |
| 535 | 535 | 'post_status' => 'publish', |
| 536 | | 'post_content' => rand_str(), |
| 537 | | 'post_title' => rand_str(), |
| | 536 | 'post_content' => 'content', |
| | 537 | 'post_title' => 'title', |
| 538 | 538 | 'post_date' => date_format( date_create( "@{$future_date}" ), 'Y-m-d H:i:s' ), |
| 539 | 539 | ); |
| 540 | 540 | |
| … |
… |
class Tests_Post extends WP_UnitTestCase { |
| 564 | 564 | $post = array( |
| 565 | 565 | 'post_author' => self::$editor_id, |
| 566 | 566 | 'post_status' => 'publish', |
| 567 | | 'post_content' => rand_str(), |
| | 567 | 'post_content' => 'content', |
| 568 | 568 | 'post_title' => '', |
| 569 | 569 | 'post_date' => '2007-10-31 06:15:00', |
| 570 | 570 | ); |
| … |
… |
class Tests_Post extends WP_UnitTestCase { |
| 782 | 782 | |
| 783 | 783 | register_taxonomy( 'test_tax', 'post' ); |
| 784 | 784 | |
| 785 | | $title = rand_str(); |
| | 785 | $title = 'title'; |
| 786 | 786 | $post_data = array( |
| 787 | 787 | 'post_author' => self::$editor_id, |
| 788 | 788 | 'post_status' => 'publish', |
| 789 | | 'post_content' => rand_str(), |
| | 789 | 'post_content' => 'content', |
| 790 | 790 | 'post_title' => $title, |
| 791 | 791 | 'tax_input' => array( |
| 792 | 792 | 'test_tax' => array( 'term', 'term2', 'term3' ), |
| … |
… |
class Tests_Post extends WP_UnitTestCase { |
| 805 | 805 | * @ticket 24803 |
| 806 | 806 | */ |
| 807 | 807 | function test_wp_count_posts() { |
| 808 | | $post_type = rand_str( 20 ); |
| | 808 | $post_type = 'foobar'; |
| 809 | 809 | register_post_type( $post_type ); |
| 810 | 810 | self::factory()->post->create( |
| 811 | 811 | array( |
| … |
… |
class Tests_Post extends WP_UnitTestCase { |
| 820 | 820 | } |
| 821 | 821 | |
| 822 | 822 | function test_wp_count_posts_filtered() { |
| 823 | | $post_type = rand_str( 20 ); |
| | 823 | $post_type = 'foobar'; |
| 824 | 824 | register_post_type( $post_type ); |
| 825 | 825 | self::factory()->post->create_many( |
| 826 | 826 | 3, |
| … |
… |
class Tests_Post extends WP_UnitTestCase { |
| 906 | 906 | register_taxonomy( $tax, $post_type ); |
| 907 | 907 | |
| 908 | 908 | $post = self::factory()->post->create( array( 'post_type' => $post_type ) ); |
| 909 | | wp_set_object_terms( $post, rand_str(), $tax ); |
| | 909 | wp_set_object_terms( $post, 'term', $tax ); |
| 910 | 910 | |
| 911 | 911 | $wp_tag_cloud = wp_tag_cloud( |
| 912 | 912 | array( |
| … |
… |
class Tests_Post extends WP_UnitTestCase { |
| 973 | 973 | array( |
| 974 | 974 | 'post_author' => self::$editor_id, |
| 975 | 975 | 'post_status' => 'publish', |
| 976 | | 'post_content' => rand_str(), |
| 977 | | 'post_title' => rand_str(), |
| | 976 | 'post_content' => 'content', |
| | 977 | 'post_title' => 'title', |
| 978 | 978 | ) |
| 979 | 979 | ); |
| 980 | 980 | $post = get_post( $post_id ); |
| … |
… |
class Tests_Post extends WP_UnitTestCase { |
| 991 | 991 | array( |
| 992 | 992 | 'post_author' => self::$editor_id, |
| 993 | 993 | 'post_status' => 'publish', |
| 994 | | 'post_content' => rand_str(), |
| 995 | | 'post_title' => rand_str(), |
| | 994 | 'post_content' => 'content', |
| | 995 | 'post_title' => 'title', |
| 996 | 996 | 'post_type' => 'page', |
| 997 | 997 | ) |
| 998 | 998 | ); |
| … |
… |
class Tests_Post extends WP_UnitTestCase { |
| 1006 | 1006 | * @ticket 31168 |
| 1007 | 1007 | */ |
| 1008 | 1008 | function test_wp_insert_post_cpt_default_comment_ping_status_open() { |
| 1009 | | $post_type = rand_str( 20 ); |
| | 1009 | $post_type = 'foobar'; |
| 1010 | 1010 | register_post_type( $post_type, array( 'supports' => array( 'comments', 'trackbacks' ) ) ); |
| 1011 | 1011 | $post_id = self::factory()->post->create( |
| 1012 | 1012 | array( |
| 1013 | 1013 | 'post_author' => self::$editor_id, |
| 1014 | 1014 | 'post_status' => 'publish', |
| 1015 | | 'post_content' => rand_str(), |
| 1016 | | 'post_title' => rand_str(), |
| | 1015 | 'post_content' => 'content', |
| | 1016 | 'post_title' => 'title', |
| 1017 | 1017 | 'post_type' => $post_type, |
| 1018 | 1018 | ) |
| 1019 | 1019 | ); |
| … |
… |
class Tests_Post extends WP_UnitTestCase { |
| 1028 | 1028 | * @ticket 31168 |
| 1029 | 1029 | */ |
| 1030 | 1030 | function test_wp_insert_post_cpt_default_comment_ping_status_closed() { |
| 1031 | | $post_type = rand_str( 20 ); |
| | 1031 | $post_type = 'foobar'; |
| 1032 | 1032 | register_post_type( $post_type ); |
| 1033 | 1033 | $post_id = self::factory()->post->create( |
| 1034 | 1034 | array( |
| 1035 | 1035 | 'post_author' => self::$editor_id, |
| 1036 | 1036 | 'post_status' => 'publish', |
| 1037 | | 'post_content' => rand_str(), |
| 1038 | | 'post_title' => rand_str(), |
| | 1037 | 'post_content' => 'content', |
| | 1038 | 'post_title' => 'title', |
| 1039 | 1039 | 'post_type' => $post_type, |
| 1040 | 1040 | ) |
| 1041 | 1041 | ); |
| … |
… |
class Tests_Post extends WP_UnitTestCase { |
| 1203 | 1203 | $post = array( |
| 1204 | 1204 | 'post_author' => self::$editor_id, |
| 1205 | 1205 | 'post_status' => 'publish', |
| 1206 | | 'post_content' => rand_str(), |
| 1207 | | 'post_title' => rand_str(), |
| | 1206 | 'post_content' => 'content', |
| | 1207 | 'post_title' => 'title', |
| 1208 | 1208 | 'post_date_gmt' => '2014-01-01 12:00:00', |
| 1209 | 1209 | ); |
| 1210 | 1210 | |
-
diff --git a/tests/phpunit/tests/post/attachments.php b/tests/phpunit/tests/post/attachments.php
index c3477367f6..d34d91519a 100644
|
a
|
b
|
class Tests_Post_Attachments extends WP_UnitTestCase { |
| 14 | 14 | } |
| 15 | 15 | |
| 16 | 16 | function test_insert_bogus_image() { |
| 17 | | $filename = rand_str() . '.jpg'; |
| 18 | | $contents = rand_str(); |
| | 17 | $filename = 'foobar.jpg'; |
| | 18 | $contents = 'baz'; |
| 19 | 19 | |
| 20 | 20 | $upload = wp_upload_bits( $filename, null, $contents ); |
| 21 | 21 | $this->assertEmpty( $upload['error'] ); |
| … |
… |
class Tests_Post_Attachments extends WP_UnitTestCase { |
| 272 | 272 | |
| 273 | 273 | $post_id = wp_insert_post( |
| 274 | 274 | array( |
| 275 | | 'post_content' => rand_str(), |
| 276 | | 'post_title' => rand_str(), |
| | 275 | 'post_content' => 'content', |
| | 276 | 'post_title' => 'title', |
| 277 | 277 | ) |
| 278 | 278 | ); |
| 279 | 279 | |
-
diff --git a/tests/phpunit/tests/post/meta.php b/tests/phpunit/tests/post/meta.php
index 1b35df99fd..d9021a9af6 100644
|
a
|
b
|
class Tests_Post_Meta extends WP_UnitTestCase { |
| 23 | 23 | array( |
| 24 | 24 | 'post_author' => self::$author->ID, |
| 25 | 25 | 'post_status' => 'publish', |
| 26 | | 'post_content' => rand_str(), |
| 27 | | 'post_title' => rand_str(), |
| | 26 | 'post_content' => 'content', |
| | 27 | 'post_title' => 'title', |
| 28 | 28 | ) |
| 29 | 29 | ); |
| 30 | 30 | |
| … |
… |
class Tests_Post_Meta extends WP_UnitTestCase { |
| 32 | 32 | array( |
| 33 | 33 | 'post_author' => self::$author->ID, |
| 34 | 34 | 'post_status' => 'publish', |
| 35 | | 'post_content' => rand_str(), |
| 36 | | 'post_title' => rand_str(), |
| | 35 | 'post_content' => 'content', |
| | 36 | 'post_title' => 'title', |
| 37 | 37 | ) |
| 38 | 38 | ); |
| 39 | 39 | } |
-
diff --git a/tests/phpunit/tests/post/nav-menu.php b/tests/phpunit/tests/post/nav-menu.php
index 4aca66ac0f..912ecef853 100644
|
a
|
b
|
class Tests_Post_Nav_Menu extends WP_UnitTestCase { |
| 12 | 12 | function set_up() { |
| 13 | 13 | parent::set_up(); |
| 14 | 14 | |
| 15 | | $this->menu_id = wp_create_nav_menu( rand_str() ); |
| | 15 | $this->menu_id = wp_create_nav_menu( 'foobar' ); |
| 16 | 16 | } |
| 17 | 17 | |
| 18 | 18 | /** |
| … |
… |
class Tests_Post_Nav_Menu extends WP_UnitTestCase { |
| 225 | 225 | * @ticket 29460 |
| 226 | 226 | */ |
| 227 | 227 | function test_orderby_name_by_default() { |
| 228 | | // We are going to create a random number of menus (min 2, max 10). |
| 229 | | $menus_no = rand( 2, 10 ); |
| | 228 | $menus_no = 10; |
| 230 | 229 | |
| 231 | 230 | for ( $i = 0; $i <= $menus_no; $i++ ) { |
| 232 | | wp_create_nav_menu( rand_str() ); |
| | 231 | wp_create_nav_menu( "nav_{$i}" ); |
| 233 | 232 | } |
| 234 | 233 | |
| 235 | 234 | // This is the expected array of menu names. |
| … |
… |
class Tests_Post_Nav_Menu extends WP_UnitTestCase { |
| 255 | 254 | */ |
| 256 | 255 | function test_wp_setup_nav_menu_item_for_post_type_archive() { |
| 257 | 256 | |
| 258 | | $post_type_slug = rand_str( 12 ); |
| 259 | | $post_type_description = rand_str(); |
| | 257 | $post_type_slug = 'fooo-bar-baz'; |
| | 258 | $post_type_description = 'foobar'; |
| 260 | 259 | register_post_type( |
| 261 | 260 | $post_type_slug, |
| 262 | 261 | array( |
| … |
… |
class Tests_Post_Nav_Menu extends WP_UnitTestCase { |
| 288 | 287 | */ |
| 289 | 288 | function test_wp_setup_nav_menu_item_for_post_type_archive_no_description() { |
| 290 | 289 | |
| 291 | | $post_type_slug = rand_str( 12 ); |
| | 290 | $post_type_slug = 'fooo-bar-baz'; |
| 292 | 291 | $post_type_description = ''; |
| 293 | 292 | register_post_type( |
| 294 | 293 | $post_type_slug, |
| … |
… |
class Tests_Post_Nav_Menu extends WP_UnitTestCase { |
| 319 | 318 | */ |
| 320 | 319 | function test_wp_setup_nav_menu_item_for_post_type_archive_custom_description() { |
| 321 | 320 | |
| 322 | | $post_type_slug = rand_str( 12 ); |
| 323 | | $post_type_description = rand_str(); |
| | 321 | $post_type_slug = 'fooo-bar-baz'; |
| | 322 | $post_type_description = 'foobaz'; |
| 324 | 323 | register_post_type( |
| 325 | 324 | $post_type_slug, |
| 326 | 325 | array( |
| … |
… |
class Tests_Post_Nav_Menu extends WP_UnitTestCase { |
| 331 | 330 | ) |
| 332 | 331 | ); |
| 333 | 332 | |
| 334 | | $menu_item_description = rand_str(); |
| | 333 | $menu_item_description = 'foo_description'; |
| 335 | 334 | |
| 336 | 335 | $post_type_archive_item_id = wp_update_nav_menu_item( |
| 337 | 336 | $this->menu_id, |
| … |
… |
class Tests_Post_Nav_Menu extends WP_UnitTestCase { |
| 354 | 353 | */ |
| 355 | 354 | function test_wp_setup_nav_menu_item_for_unknown_post_type_archive_no_description() { |
| 356 | 355 | |
| 357 | | $post_type_slug = rand_str( 12 ); |
| | 356 | $post_type_slug = 'fooo-bar-baz'; |
| 358 | 357 | |
| 359 | 358 | $post_type_archive_item_id = wp_update_nav_menu_item( |
| 360 | 359 | $this->menu_id, |
-
diff --git a/tests/phpunit/tests/post/query.php b/tests/phpunit/tests/post/query.php
index 6622813ef9..56aca5ffb0 100644
|
a
|
b
|
class Tests_Post_Query extends WP_UnitTestCase { |
| 132 | 132 | $post_id1 = self::factory()->post->create( |
| 133 | 133 | array( |
| 134 | 134 | 'post_type' => 'page', |
| 135 | | 'menu_order' => rand( 1, 100 ), |
| | 135 | 'menu_order' => 1, |
| 136 | 136 | ) |
| 137 | 137 | ); |
| 138 | 138 | $post_id2 = self::factory()->post->create( |
| 139 | 139 | array( |
| 140 | 140 | 'post_type' => 'page', |
| 141 | | 'menu_order' => rand( 1, 100 ), |
| | 141 | 'menu_order' => 2, |
| 142 | 142 | ) |
| 143 | 143 | ); |
| 144 | 144 | $post_id3 = self::factory()->post->create( |
| 145 | 145 | array( |
| 146 | 146 | 'post_type' => 'page', |
| 147 | 147 | 'post_parent' => $post_id2, |
| 148 | | 'menu_order' => rand( 1, 100 ), |
| | 148 | 'menu_order' => 3, |
| 149 | 149 | ) |
| 150 | 150 | ); |
| 151 | 151 | $post_id4 = self::factory()->post->create( |
| 152 | 152 | array( |
| 153 | 153 | 'post_type' => 'page', |
| 154 | 154 | 'post_parent' => $post_id2, |
| 155 | | 'menu_order' => rand( 1, 100 ), |
| | 155 | 'menu_order' => 4, |
| 156 | 156 | ) |
| 157 | 157 | ); |
| 158 | 158 | $post_id5 = self::factory()->post->create( |
| 159 | 159 | array( |
| 160 | 160 | 'post_type' => 'page', |
| 161 | | 'menu_order' => rand( 1, 100 ), |
| | 161 | 'menu_order' => 5, |
| 162 | 162 | ) |
| 163 | 163 | ); |
| 164 | 164 | |
| … |
… |
class Tests_Post_Query extends WP_UnitTestCase { |
| 219 | 219 | $post_id, |
| 220 | 220 | array( |
| 221 | 221 | 'post_mime_type' => 'image/jpeg', |
| 222 | | 'menu_order' => rand( 1, 100 ), |
| | 222 | 'menu_order' => 1, |
| 223 | 223 | ) |
| 224 | 224 | ); |
| 225 | 225 | $att_ids[2] = self::factory()->attachment->create_object( |
| … |
… |
class Tests_Post_Query extends WP_UnitTestCase { |
| 227 | 227 | $post_id, |
| 228 | 228 | array( |
| 229 | 229 | 'post_mime_type' => 'image/jpeg', |
| 230 | | 'menu_order' => rand( 1, 100 ), |
| | 230 | 'menu_order' => 2, |
| 231 | 231 | ) |
| 232 | 232 | ); |
| 233 | 233 | $att_ids[3] = self::factory()->attachment->create_object( |
| … |
… |
class Tests_Post_Query extends WP_UnitTestCase { |
| 235 | 235 | $post_id, |
| 236 | 236 | array( |
| 237 | 237 | 'post_mime_type' => 'image/jpeg', |
| 238 | | 'menu_order' => rand( 1, 100 ), |
| | 238 | 'menu_order' => 3, |
| 239 | 239 | ) |
| 240 | 240 | ); |
| 241 | 241 | $att_ids[4] = self::factory()->attachment->create_object( |
| … |
… |
class Tests_Post_Query extends WP_UnitTestCase { |
| 243 | 243 | $post_id, |
| 244 | 244 | array( |
| 245 | 245 | 'post_mime_type' => 'image/jpeg', |
| 246 | | 'menu_order' => rand( 1, 100 ), |
| | 246 | 'menu_order' => 4, |
| 247 | 247 | ) |
| 248 | 248 | ); |
| 249 | 249 | $att_ids[5] = self::factory()->attachment->create_object( |
| … |
… |
class Tests_Post_Query extends WP_UnitTestCase { |
| 251 | 251 | $post_id, |
| 252 | 252 | array( |
| 253 | 253 | 'post_mime_type' => 'image/jpeg', |
| 254 | | 'menu_order' => rand( 1, 100 ), |
| | 254 | 'menu_order' => 5, |
| 255 | 255 | ) |
| 256 | 256 | ); |
| 257 | 257 | |
-
diff --git a/tests/phpunit/tests/post/revisions.php b/tests/phpunit/tests/post/revisions.php
index 840597c4a9..de956b665a 100644
|
a
|
b
|
class Tests_Post_Revisions extends WP_UnitTestCase { |
| 17 | 17 | |
| 18 | 18 | function set_up() { |
| 19 | 19 | parent::set_up(); |
| 20 | | $this->post_type = rand_str( 20 ); |
| | 20 | $this->post_type = 'foobar'; |
| 21 | 21 | } |
| 22 | 22 | |
| 23 | 23 | /** |
| … |
… |
class Tests_Post_Revisions extends WP_UnitTestCase { |
| 446 | 446 | array( |
| 447 | 447 | 'post_status' => 'publish', |
| 448 | 448 | 'ID' => $post_id, |
| 449 | | 'post_content' => rand_str(), |
| | 449 | 'post_content' => 'content', |
| 450 | 450 | ) |
| 451 | 451 | ); |
| 452 | 452 | |
-
diff --git a/tests/phpunit/tests/post/types.php b/tests/phpunit/tests/post/types.php
index a6631d7880..fbc29813f2 100644
|
a
|
b
|
class Tests_Post_Types extends WP_UnitTestCase { |
| 21 | 21 | function set_up() { |
| 22 | 22 | parent::set_up(); |
| 23 | 23 | |
| 24 | | $this->post_type = rand_str( 20 ); |
| | 24 | $this->post_type = 'foobar'; |
| 25 | 25 | } |
| 26 | 26 | |
| 27 | 27 | function test_register_post_type() { |
-
diff --git a/tests/phpunit/tests/query/commentCount.php b/tests/phpunit/tests/query/commentCount.php
index 5c8bd2df26..cf05a5c03c 100644
|
a
|
b
|
class Tests_Query_CommentCount extends WP_UnitTestCase { |
| 21 | 21 | public static function wpSetUpBeforeClass( WP_UnitTest_Factory $factory ) { |
| 22 | 22 | $post_id = $factory->post->create( |
| 23 | 23 | array( |
| 24 | | 'post_content' => 1 . rand_str() . ' about', |
| | 24 | 'post_content' => '1 about', |
| 25 | 25 | 'post_type' => self::$post_type, |
| 26 | 26 | ) |
| 27 | 27 | ); |
| … |
… |
class Tests_Query_CommentCount extends WP_UnitTestCase { |
| 30 | 30 | |
| 31 | 31 | $post_id = $factory->post->create( |
| 32 | 32 | array( |
| 33 | | 'post_content' => 1 . rand_str() . ' about', |
| | 33 | 'post_content' => '2 about', |
| 34 | 34 | 'post_type' => self::$post_type, |
| 35 | 35 | ) |
| 36 | 36 | ); |
| … |
… |
class Tests_Query_CommentCount extends WP_UnitTestCase { |
| 41 | 41 | |
| 42 | 42 | $post_id = $factory->post->create( |
| 43 | 43 | array( |
| 44 | | 'post_content' => 1 . rand_str() . ' about', |
| | 44 | 'post_content' => '3 about', |
| 45 | 45 | 'post_type' => self::$post_type, |
| 46 | 46 | ) |
| 47 | 47 | ); |
| … |
… |
class Tests_Query_CommentCount extends WP_UnitTestCase { |
| 52 | 52 | |
| 53 | 53 | $post_id = $factory->post->create( |
| 54 | 54 | array( |
| 55 | | 'post_content' => 1 . rand_str() . ' about', |
| | 55 | 'post_content' => '4 about', |
| 56 | 56 | 'post_type' => self::$post_type, |
| 57 | 57 | ) |
| 58 | 58 | ); |
-
diff --git a/tests/phpunit/tests/query/search.php b/tests/phpunit/tests/query/search.php
index 1cc35f4a21..8c5573be77 100644
|
a
|
b
|
class Tests_Query_Search extends WP_UnitTestCase { |
| 10 | 10 | function set_up() { |
| 11 | 11 | parent::set_up(); |
| 12 | 12 | |
| 13 | | $this->post_type = rand_str( 12 ); |
| | 13 | $this->post_type = 'foobar'; |
| 14 | 14 | register_post_type( $this->post_type ); |
| 15 | 15 | |
| 16 | 16 | $this->q = new WP_Query(); |
| … |
… |
class Tests_Query_Search extends WP_UnitTestCase { |
| 36 | 36 | foreach ( range( 1, 7 ) as $i ) { |
| 37 | 37 | self::factory()->post->create( |
| 38 | 38 | array( |
| 39 | | 'post_content' => $i . rand_str() . ' about', |
| | 39 | 'post_content' => "{$i} about", |
| 40 | 40 | 'post_type' => $this->post_type, |
| 41 | 41 | ) |
| 42 | 42 | ); |
-
diff --git a/tests/phpunit/tests/query/taxQuery.php b/tests/phpunit/tests/query/taxQuery.php
index 2ca00b605b..b1e5a5b544 100644
|
a
|
b
|
class Tests_Query_TaxQuery extends WP_UnitTestCase { |
| 1209 | 1209 | register_taxonomy_for_object_type( 'post_tag', 'attachment:image' ); |
| 1210 | 1210 | $tag_id = self::factory()->term->create( |
| 1211 | 1211 | array( |
| 1212 | | 'slug' => rand_str(), |
| 1213 | | 'name' => rand_str(), |
| | 1212 | 'slug' => 'foo-bar', |
| | 1213 | 'name' => 'foobar', |
| 1214 | 1214 | ) |
| 1215 | 1215 | ); |
| 1216 | 1216 | $image_id = self::factory()->attachment->create_object( |
-
diff --git a/tests/phpunit/tests/rest-api/rest-attachments-controller.php b/tests/phpunit/tests/rest-api/rest-attachments-controller.php
index 14c1f08075..e3815637ae 100644
|
a
|
b
|
class WP_Test_REST_Attachments_Controller extends WP_Test_REST_Post_Type_Control |
| 520 | 520 | |
| 521 | 521 | public function test_get_items_invalid_date() { |
| 522 | 522 | $request = new WP_REST_Request( 'GET', '/wp/v2/media' ); |
| 523 | | $request->set_param( 'after', rand_str() ); |
| 524 | | $request->set_param( 'before', rand_str() ); |
| | 523 | $request->set_param( 'after', 'foo' ); |
| | 524 | $request->set_param( 'before', 'bar' ); |
| 525 | 525 | $response = rest_get_server()->dispatch( $request ); |
| 526 | 526 | $this->assertErrorResponse( 'rest_invalid_param', $response, 400 ); |
| 527 | 527 | } |
| … |
… |
class WP_Test_REST_Attachments_Controller extends WP_Test_REST_Post_Type_Control |
| 568 | 568 | */ |
| 569 | 569 | public function test_get_items_invalid_modified_date() { |
| 570 | 570 | $request = new WP_REST_Request( 'GET', '/wp/v2/media' ); |
| 571 | | $request->set_param( 'modified_after', rand_str() ); |
| 572 | | $request->set_param( 'modified_before', rand_str() ); |
| | 571 | $request->set_param( 'modified_after', 'foo' ); |
| | 572 | $request->set_param( 'modified_before', 'bar' ); |
| 573 | 573 | $response = rest_get_server()->dispatch( $request ); |
| 574 | 574 | $this->assertErrorResponse( 'rest_invalid_param', $response, 400 ); |
| 575 | 575 | } |
-
diff --git a/tests/phpunit/tests/rest-api/rest-comments-controller.php b/tests/phpunit/tests/rest-api/rest-comments-controller.php
index 0c7ed625b7..661c406ebe 100644
|
a
|
b
|
class WP_Test_REST_Comments_Controller extends WP_Test_REST_Controller_Testcase |
| 888 | 888 | |
| 889 | 889 | public function test_get_comments_invalid_date() { |
| 890 | 890 | $request = new WP_REST_Request( 'GET', '/wp/v2/comments' ); |
| 891 | | $request->set_param( 'after', rand_str() ); |
| 892 | | $request->set_param( 'before', rand_str() ); |
| | 891 | $request->set_param( 'after', 'foo' ); |
| | 892 | $request->set_param( 'before', 'bar' ); |
| 893 | 893 | $response = rest_get_server()->dispatch( $request ); |
| 894 | 894 | $this->assertErrorResponse( 'rest_invalid_param', $response, 400 ); |
| 895 | 895 | } |
| … |
… |
class WP_Test_REST_Comments_Controller extends WP_Test_REST_Controller_Testcase |
| 1477 | 1477 | 'author_email' => 'lovejoy@example.com', |
| 1478 | 1478 | 'author_url' => 'http://timothylovejoy.jr', |
| 1479 | 1479 | 'content' => 'It\'s all over\, people! We don\'t have a prayer!', |
| 1480 | | 'date' => rand_str(), |
| | 1480 | 'date' => 'foobar', |
| 1481 | 1481 | ); |
| 1482 | 1482 | |
| 1483 | 1483 | $request = new WP_REST_Request( 'POST', '/wp/v2/comments' ); |
| … |
… |
class WP_Test_REST_Comments_Controller extends WP_Test_REST_Controller_Testcase |
| 2625 | 2625 | wp_set_current_user( self::$admin_id ); |
| 2626 | 2626 | |
| 2627 | 2627 | $params = array( |
| 2628 | | 'content' => rand_str(), |
| 2629 | | 'date' => rand_str(), |
| | 2628 | 'content' => 'content', |
| | 2629 | 'date' => 'foo', |
| 2630 | 2630 | ); |
| 2631 | 2631 | |
| 2632 | 2632 | $request = new WP_REST_Request( 'PUT', sprintf( '/wp/v2/comments/%d', self::$approved_id ) ); |
| … |
… |
class WP_Test_REST_Comments_Controller extends WP_Test_REST_Controller_Testcase |
| 2641 | 2641 | wp_set_current_user( self::$admin_id ); |
| 2642 | 2642 | |
| 2643 | 2643 | $params = array( |
| 2644 | | 'content' => rand_str(), |
| 2645 | | 'date_gmt' => rand_str(), |
| | 2644 | 'content' => 'content', |
| | 2645 | 'date_gmt' => 'foo', |
| 2646 | 2646 | ); |
| 2647 | 2647 | |
| 2648 | 2648 | $request = new WP_REST_Request( 'PUT', sprintf( '/wp/v2/comments/%d', self::$approved_id ) ); |
| … |
… |
class WP_Test_REST_Comments_Controller extends WP_Test_REST_Controller_Testcase |
| 2770 | 2770 | // Change the comment parent. |
| 2771 | 2771 | $request = new WP_REST_Request( 'PUT', sprintf( '/wp/v2/comments/%s', $child_comment ) ); |
| 2772 | 2772 | $request->set_param( 'parent', $comment_id_1 ); |
| 2773 | | $request->set_param( 'content', rand_str() ); |
| | 2773 | $request->set_param( 'content', 'foobar' ); |
| 2774 | 2774 | $response = rest_get_server()->dispatch( $request ); |
| 2775 | 2775 | $this->assertSame( 200, $response->get_status() ); |
| 2776 | 2776 | |
-
diff --git a/tests/phpunit/tests/rest-api/rest-pages-controller.php b/tests/phpunit/tests/rest-api/rest-pages-controller.php
index 00047cce80..ed5000e242 100644
|
a
|
b
|
class WP_Test_REST_Pages_Controller extends WP_Test_REST_Post_Type_Controller_Te |
| 329 | 329 | |
| 330 | 330 | public function test_get_items_invalid_date() { |
| 331 | 331 | $request = new WP_REST_Request( 'GET', '/wp/v2/pages' ); |
| 332 | | $request->set_param( 'after', rand_str() ); |
| 333 | | $request->set_param( 'before', rand_str() ); |
| | 332 | $request->set_param( 'after', 'foo' ); |
| | 333 | $request->set_param( 'before', 'bar' ); |
| 334 | 334 | $response = rest_get_server()->dispatch( $request ); |
| 335 | 335 | $this->assertErrorResponse( 'rest_invalid_param', $response, 400 ); |
| 336 | 336 | } |
| … |
… |
class WP_Test_REST_Pages_Controller extends WP_Test_REST_Post_Type_Controller_Te |
| 368 | 368 | */ |
| 369 | 369 | public function test_get_items_invalid_modified_date() { |
| 370 | 370 | $request = new WP_REST_Request( 'GET', '/wp/v2/pages' ); |
| 371 | | $request->set_param( 'modified_after', rand_str() ); |
| 372 | | $request->set_param( 'modified_before', rand_str() ); |
| | 371 | $request->set_param( 'modified_after', 'foo' ); |
| | 372 | $request->set_param( 'modified_before', 'bar' ); |
| 373 | 373 | $response = rest_get_server()->dispatch( $request ); |
| 374 | 374 | $this->assertErrorResponse( 'rest_invalid_param', $response, 400 ); |
| 375 | 375 | } |
-
diff --git a/tests/phpunit/tests/rest-api/rest-posts-controller.php b/tests/phpunit/tests/rest-api/rest-posts-controller.php
index b35921a73d..8a7636c259 100644
|
a
|
b
|
class WP_Test_REST_Posts_Controller extends WP_Test_REST_Post_Type_Controller_Te |
| 1692 | 1692 | |
| 1693 | 1693 | public function test_get_items_invalid_date() { |
| 1694 | 1694 | $request = new WP_REST_Request( 'GET', '/wp/v2/posts' ); |
| 1695 | | $request->set_param( 'after', rand_str() ); |
| 1696 | | $request->set_param( 'before', rand_str() ); |
| | 1695 | $request->set_param( 'after', 'foo' ); |
| | 1696 | $request->set_param( 'before', 'bar' ); |
| 1697 | 1697 | $response = rest_get_server()->dispatch( $request ); |
| 1698 | 1698 | $this->assertErrorResponse( 'rest_invalid_param', $response, 400 ); |
| 1699 | 1699 | } |
| … |
… |
class WP_Test_REST_Posts_Controller extends WP_Test_REST_Post_Type_Controller_Te |
| 1717 | 1717 | */ |
| 1718 | 1718 | public function test_get_items_invalid_modified_date() { |
| 1719 | 1719 | $request = new WP_REST_Request( 'GET', '/wp/v2/posts' ); |
| 1720 | | $request->set_param( 'modified_after', rand_str() ); |
| 1721 | | $request->set_param( 'modified_before', rand_str() ); |
| | 1720 | $request->set_param( 'modified_after', 'foo' ); |
| | 1721 | $request->set_param( 'modified_before', 'bar' ); |
| 1722 | 1722 | $response = rest_get_server()->dispatch( $request ); |
| 1723 | 1723 | $this->assertErrorResponse( 'rest_invalid_param', $response, 400 ); |
| 1724 | 1724 | } |
| … |
… |
class WP_Test_REST_Posts_Controller extends WP_Test_REST_Post_Type_Controller_Te |
| 2695 | 2695 | 0, |
| 2696 | 2696 | array( |
| 2697 | 2697 | 'post_mime_type' => 'image/jpeg', |
| 2698 | | 'menu_order' => rand( 1, 100 ), |
| | 2698 | 'menu_order' => 1, |
| 2699 | 2699 | ) |
| 2700 | 2700 | ); |
| 2701 | 2701 | |
| … |
… |
class WP_Test_REST_Posts_Controller extends WP_Test_REST_Post_Type_Controller_Te |
| 3308 | 3308 | public function test_update_post_ignore_readonly() { |
| 3309 | 3309 | wp_set_current_user( self::$editor_id ); |
| 3310 | 3310 | |
| 3311 | | $new_content = rand_str(); |
| | 3311 | $new_content = 'foobar'; |
| 3312 | 3312 | $expected_modified = current_time( 'mysql' ); |
| 3313 | 3313 | |
| 3314 | 3314 | $request = new WP_REST_Request( 'PUT', sprintf( '/wp/v2/posts/%d', self::$post_id ) ); |
| … |
… |
class WP_Test_REST_Posts_Controller extends WP_Test_REST_Post_Type_Controller_Te |
| 3373 | 3373 | $request = new WP_REST_Request( 'PUT', sprintf( '/wp/v2/posts/%d', self::$post_id ) ); |
| 3374 | 3374 | $params = $this->set_post_data( |
| 3375 | 3375 | array( |
| 3376 | | 'date' => rand_str(), |
| | 3376 | 'date' => 'foo', |
| 3377 | 3377 | ) |
| 3378 | 3378 | ); |
| 3379 | 3379 | $request->set_body_params( $params ); |
| … |
… |
class WP_Test_REST_Posts_Controller extends WP_Test_REST_Post_Type_Controller_Te |
| 3388 | 3388 | $request = new WP_REST_Request( 'PUT', sprintf( '/wp/v2/posts/%d', self::$post_id ) ); |
| 3389 | 3389 | $params = $this->set_post_data( |
| 3390 | 3390 | array( |
| 3391 | | 'date_gmt' => rand_str(), |
| | 3391 | 'date_gmt' => 'foo', |
| 3392 | 3392 | ) |
| 3393 | 3393 | ); |
| 3394 | 3394 | $request->set_body_params( $params ); |
-
diff --git a/tests/phpunit/tests/rewrite.php b/tests/phpunit/tests/rewrite.php
index 8f54a0dc89..09f82619aa 100644
|
a
|
b
|
class Tests_Rewrite extends WP_UnitTestCase { |
| 173 | 173 | function test_url_to_postid_custom_post_type() { |
| 174 | 174 | delete_option( 'rewrite_rules' ); |
| 175 | 175 | |
| 176 | | $post_type = rand_str( 12 ); |
| | 176 | $post_type = 'foobar'; |
| 177 | 177 | register_post_type( $post_type, array( 'public' => true ) ); |
| 178 | 178 | |
| 179 | 179 | $id = self::factory()->post->create( array( 'post_type' => $post_type ) ); |
-
diff --git a/tests/phpunit/tests/rewrite/numericSlugs.php b/tests/phpunit/tests/rewrite/numericSlugs.php
index e11c6b2a46..41ef636368 100644
|
a
|
b
|
class Tests_Rewrite_NumericSlugs extends WP_UnitTestCase { |
| 23 | 23 | array( |
| 24 | 24 | 'post_author' => $this->author_id, |
| 25 | 25 | 'post_status' => 'publish', |
| 26 | | 'post_content' => rand_str(), |
| | 26 | 'post_content' => 'content', |
| 27 | 27 | 'post_title' => '', |
| 28 | 28 | 'post_name' => '2015', |
| 29 | 29 | 'post_date' => '2015-02-01 01:00:00', |
| … |
… |
class Tests_Rewrite_NumericSlugs extends WP_UnitTestCase { |
| 53 | 53 | array( |
| 54 | 54 | 'post_author' => $this->author_id, |
| 55 | 55 | 'post_status' => 'publish', |
| 56 | | 'post_content' => rand_str(), |
| | 56 | 'post_content' => 'content', |
| 57 | 57 | 'post_title' => '', |
| 58 | 58 | 'post_name' => '2015', |
| 59 | 59 | 'post_date' => '2015-02-01 01:00:00', |
| … |
… |
class Tests_Rewrite_NumericSlugs extends WP_UnitTestCase { |
| 80 | 80 | array( |
| 81 | 81 | 'post_author' => $this->author_id, |
| 82 | 82 | 'post_status' => 'publish', |
| 83 | | 'post_content' => rand_str(), |
| | 83 | 'post_content' => 'content', |
| 84 | 84 | 'post_title' => '2015', |
| 85 | 85 | 'post_date' => '2015-02-01 01:00:00', |
| 86 | 86 | ) |
| … |
… |
class Tests_Rewrite_NumericSlugs extends WP_UnitTestCase { |
| 98 | 98 | array( |
| 99 | 99 | 'post_author' => $this->author_id, |
| 100 | 100 | 'post_status' => 'publish', |
| 101 | | 'post_content' => rand_str(), |
| | 101 | 'post_content' => 'content', |
| 102 | 102 | 'post_title' => '2015', |
| 103 | 103 | 'post_date' => '2015-02-01 01:00:00', |
| 104 | 104 | ) |
| … |
… |
class Tests_Rewrite_NumericSlugs extends WP_UnitTestCase { |
| 114 | 114 | array( |
| 115 | 115 | 'post_author' => $this->author_id, |
| 116 | 116 | 'post_status' => 'publish', |
| 117 | | 'post_content' => rand_str(), |
| | 117 | 'post_content' => 'content', |
| 118 | 118 | 'post_title' => '', |
| 119 | 119 | 'post_name' => '02', |
| 120 | 120 | 'post_date' => '2015-02-01 01:00:00', |
| … |
… |
class Tests_Rewrite_NumericSlugs extends WP_UnitTestCase { |
| 133 | 133 | array( |
| 134 | 134 | 'post_author' => $this->author_id, |
| 135 | 135 | 'post_status' => 'publish', |
| 136 | | 'post_content' => rand_str(), |
| | 136 | 'post_content' => 'content', |
| 137 | 137 | 'post_title' => '', |
| 138 | 138 | 'post_name' => '02', |
| 139 | 139 | 'post_date' => '2015-02-01 01:00:00', |
| … |
… |
class Tests_Rewrite_NumericSlugs extends WP_UnitTestCase { |
| 150 | 150 | array( |
| 151 | 151 | 'post_author' => $this->author_id, |
| 152 | 152 | 'post_status' => 'publish', |
| 153 | | 'post_content' => rand_str(), |
| | 153 | 'post_content' => 'content', |
| 154 | 154 | 'post_title' => '', |
| 155 | 155 | 'post_name' => '2', |
| 156 | 156 | 'post_date' => '2015-02-01 01:00:00', |
| … |
… |
class Tests_Rewrite_NumericSlugs extends WP_UnitTestCase { |
| 169 | 169 | array( |
| 170 | 170 | 'post_author' => $this->author_id, |
| 171 | 171 | 'post_status' => 'publish', |
| 172 | | 'post_content' => rand_str(), |
| | 172 | 'post_content' => 'content', |
| 173 | 173 | 'post_title' => '', |
| 174 | 174 | 'post_name' => '2', |
| 175 | 175 | 'post_date' => '2015-02-01 01:00:00', |
| … |
… |
class Tests_Rewrite_NumericSlugs extends WP_UnitTestCase { |
| 186 | 186 | array( |
| 187 | 187 | 'post_author' => $this->author_id, |
| 188 | 188 | 'post_status' => 'publish', |
| 189 | | 'post_content' => rand_str(), |
| | 189 | 'post_content' => 'content', |
| 190 | 190 | 'post_title' => '02', |
| 191 | 191 | 'post_date' => '2015-02-01 01:00:00', |
| 192 | 192 | ) |
| … |
… |
class Tests_Rewrite_NumericSlugs extends WP_UnitTestCase { |
| 204 | 204 | array( |
| 205 | 205 | 'post_author' => $this->author_id, |
| 206 | 206 | 'post_status' => 'publish', |
| 207 | | 'post_content' => rand_str(), |
| | 207 | 'post_content' => 'content', |
| 208 | 208 | 'post_title' => '02', |
| 209 | 209 | 'post_date' => '2015-02-01 01:00:00', |
| 210 | 210 | ) |
| … |
… |
class Tests_Rewrite_NumericSlugs extends WP_UnitTestCase { |
| 220 | 220 | array( |
| 221 | 221 | 'post_author' => $this->author_id, |
| 222 | 222 | 'post_status' => 'publish', |
| 223 | | 'post_content' => rand_str(), |
| | 223 | 'post_content' => 'content', |
| 224 | 224 | 'post_title' => '2', |
| 225 | 225 | 'post_date' => '2015-02-01 01:00:00', |
| 226 | 226 | ) |
| … |
… |
class Tests_Rewrite_NumericSlugs extends WP_UnitTestCase { |
| 238 | 238 | array( |
| 239 | 239 | 'post_author' => $this->author_id, |
| 240 | 240 | 'post_status' => 'publish', |
| 241 | | 'post_content' => rand_str(), |
| | 241 | 'post_content' => 'content', |
| 242 | 242 | 'post_title' => '2', |
| 243 | 243 | 'post_date' => '2015-02-01 01:00:00', |
| 244 | 244 | ) |
| … |
… |
class Tests_Rewrite_NumericSlugs extends WP_UnitTestCase { |
| 254 | 254 | array( |
| 255 | 255 | 'post_author' => $this->author_id, |
| 256 | 256 | 'post_status' => 'publish', |
| 257 | | 'post_content' => rand_str(), |
| | 257 | 'post_content' => 'content', |
| 258 | 258 | 'post_title' => '', |
| 259 | 259 | 'post_name' => '01', |
| 260 | 260 | 'post_date' => '2015-02-01 01:00:00', |
| … |
… |
class Tests_Rewrite_NumericSlugs extends WP_UnitTestCase { |
| 273 | 273 | array( |
| 274 | 274 | 'post_author' => $this->author_id, |
| 275 | 275 | 'post_status' => 'publish', |
| 276 | | 'post_content' => rand_str(), |
| | 276 | 'post_content' => 'content', |
| 277 | 277 | 'post_title' => '', |
| 278 | 278 | 'post_name' => '01', |
| 279 | 279 | 'post_date' => '2015-02-01 01:00:00', |
| … |
… |
class Tests_Rewrite_NumericSlugs extends WP_UnitTestCase { |
| 290 | 290 | array( |
| 291 | 291 | 'post_author' => $this->author_id, |
| 292 | 292 | 'post_status' => 'publish', |
| 293 | | 'post_content' => rand_str(), |
| | 293 | 'post_content' => 'content', |
| 294 | 294 | 'post_title' => '01', |
| 295 | 295 | 'post_date' => '2015-02-01 01:00:00', |
| 296 | 296 | ) |
| … |
… |
class Tests_Rewrite_NumericSlugs extends WP_UnitTestCase { |
| 308 | 308 | array( |
| 309 | 309 | 'post_author' => $this->author_id, |
| 310 | 310 | 'post_status' => 'publish', |
| 311 | | 'post_content' => rand_str(), |
| | 311 | 'post_content' => 'content', |
| 312 | 312 | 'post_title' => '01', |
| 313 | 313 | 'post_date' => '2015-02-01 01:00:00', |
| 314 | 314 | ) |
| … |
… |
class Tests_Rewrite_NumericSlugs extends WP_UnitTestCase { |
| 324 | 324 | array( |
| 325 | 325 | 'post_author' => $this->author_id, |
| 326 | 326 | 'post_status' => 'publish', |
| 327 | | 'post_content' => rand_str(), |
| | 327 | 'post_content' => 'content', |
| 328 | 328 | 'post_title' => '01', |
| 329 | 329 | 'post_date' => '2015-02-01 01:00:00', |
| 330 | 330 | ) |
-
diff --git a/tests/phpunit/tests/shortcode.php b/tests/phpunit/tests/shortcode.php
index 479f6d059a..f315c07151 100644
|
a
|
b
|
class Tests_Shortcode extends WP_UnitTestCase { |
| 269 | 269 | } |
| 270 | 270 | |
| 271 | 271 | function test_footag_val() { |
| 272 | | $val = rand_str(); |
| | 272 | $val = 'baz'; |
| 273 | 273 | $out = do_shortcode( '[footag foo="' . $val . '"]' ); |
| 274 | 274 | $this->assertSame( 'foo = ' . $val, $out ); |
| 275 | 275 | } |
-
diff --git a/tests/phpunit/tests/taxonomy.php b/tests/phpunit/tests/taxonomy.php
index 6469563a08..0ae27750bf 100644
|
a
|
b
|
class Tests_Taxonomy extends WP_UnitTestCase { |
| 17 | 17 | */ |
| 18 | 18 | function test_get_unknown_taxonomies() { |
| 19 | 19 | // Taxonomies for an unknown object type. |
| 20 | | $this->assertSame( array(), get_object_taxonomies( rand_str() ) ); |
| | 20 | $this->assertSame( array(), get_object_taxonomies( 'foobar' ) ); |
| 21 | 21 | $this->assertSame( array(), get_object_taxonomies( '' ) ); |
| 22 | 22 | $this->assertSame( array(), get_object_taxonomies( 0 ) ); |
| 23 | 23 | $this->assertSame( array(), get_object_taxonomies( null ) ); |
| … |
… |
class Tests_Taxonomy extends WP_UnitTestCase { |
| 122 | 122 | } |
| 123 | 123 | |
| 124 | 124 | function test_taxonomy_exists_unknown() { |
| 125 | | $this->assertFalse( taxonomy_exists( rand_str() ) ); |
| | 125 | $this->assertFalse( taxonomy_exists( 'foobar' ) ); |
| 126 | 126 | $this->assertFalse( taxonomy_exists( '' ) ); |
| 127 | 127 | $this->assertFalse( taxonomy_exists( 0 ) ); |
| 128 | 128 | $this->assertFalse( taxonomy_exists( null ) ); |
| … |
… |
class Tests_Taxonomy extends WP_UnitTestCase { |
| 135 | 135 | } |
| 136 | 136 | |
| 137 | 137 | function test_is_taxonomy_hierarchical_unknown() { |
| 138 | | $this->assertFalse( is_taxonomy_hierarchical( rand_str() ) ); |
| | 138 | $this->assertFalse( is_taxonomy_hierarchical( 'foobar' ) ); |
| 139 | 139 | $this->assertFalse( is_taxonomy_hierarchical( '' ) ); |
| 140 | 140 | $this->assertFalse( is_taxonomy_hierarchical( 0 ) ); |
| 141 | 141 | $this->assertFalse( is_taxonomy_hierarchical( null ) ); |
| … |
… |
class Tests_Taxonomy extends WP_UnitTestCase { |
| 144 | 144 | function test_register_taxonomy() { |
| 145 | 145 | |
| 146 | 146 | // Make up a new taxonomy name, and ensure it's unused. |
| 147 | | $tax = rand_str(); |
| | 147 | $tax = 'tax_new'; |
| 148 | 148 | $this->assertFalse( taxonomy_exists( $tax ) ); |
| 149 | 149 | |
| 150 | 150 | register_taxonomy( $tax, 'post' ); |
| … |
… |
class Tests_Taxonomy extends WP_UnitTestCase { |
| 158 | 158 | function test_register_hierarchical_taxonomy() { |
| 159 | 159 | |
| 160 | 160 | // Make up a new taxonomy name, and ensure it's unused. |
| 161 | | $tax = rand_str(); |
| | 161 | $tax = 'tax_new'; |
| 162 | 162 | $this->assertFalse( taxonomy_exists( $tax ) ); |
| 163 | 163 | |
| 164 | 164 | register_taxonomy( $tax, 'post', array( 'hierarchical' => true ) ); |
-
diff --git a/tests/phpunit/tests/term.php b/tests/phpunit/tests/term.php
index d18b4ef1ff..0fa1a43076 100644
|
a
|
b
|
class Tests_Term extends WP_UnitTestCase { |
| 51 | 51 | */ |
| 52 | 52 | function test_is_term_type() { |
| 53 | 53 | // Insert a term. |
| 54 | | $term = rand_str(); |
| | 54 | $term = 'term_new'; |
| 55 | 55 | $t = wp_insert_term( $term, $this->taxonomy ); |
| 56 | 56 | $this->assertIsArray( $t ); |
| 57 | 57 | $term_obj = get_term_by( 'name', $term, $this->taxonomy ); |
| … |
… |
class Tests_Term extends WP_UnitTestCase { |
| 128 | 128 | * @group category.php |
| 129 | 129 | */ |
| 130 | 130 | function test_term_is_ancestor_of() { |
| 131 | | $term = rand_str(); |
| 132 | | $term2 = rand_str(); |
| | 131 | $term = 'term'; |
| | 132 | $term2 = 'term2'; |
| 133 | 133 | |
| 134 | 134 | $t = wp_insert_term( $term, 'category' ); |
| 135 | 135 | $this->assertIsArray( $t ); |
| … |
… |
class Tests_Term extends WP_UnitTestCase { |
| 147 | 147 | } |
| 148 | 148 | |
| 149 | 149 | function test_wp_insert_delete_category() { |
| 150 | | $term = rand_str(); |
| | 150 | $term = 'term'; |
| 151 | 151 | $this->assertNull( category_exists( $term ) ); |
| 152 | 152 | |
| 153 | 153 | $initial_count = wp_count_terms( array( 'taxonomy' => 'category' ) ); |
-
diff --git a/tests/phpunit/tests/term/getTermField.php b/tests/phpunit/tests/term/getTermField.php
index 9761d87662..b5448c8be0 100644
|
a
|
b
|
class Tests_Term_getTermField extends WP_UnitTestCase { |
| 91 | 91 | } |
| 92 | 92 | |
| 93 | 93 | public function test_get_term_field_name() { |
| 94 | | $name = rand_str( 15 ); |
| | 94 | $name = 'foobar'; |
| 95 | 95 | |
| 96 | 96 | $term = self::factory()->term->create_and_get( |
| 97 | 97 | array( |
| … |
… |
class Tests_Term_getTermField extends WP_UnitTestCase { |
| 106 | 106 | } |
| 107 | 107 | |
| 108 | 108 | public function test_get_term_field_slug_when_slug_is_set() { |
| 109 | | $slug = rand_str( 15 ); |
| | 109 | $slug = 'foobar'; |
| 110 | 110 | |
| 111 | 111 | $term = self::factory()->term->create_and_get( |
| 112 | 112 | array( |
| … |
… |
class Tests_Term_getTermField extends WP_UnitTestCase { |
| 121 | 121 | } |
| 122 | 122 | |
| 123 | 123 | public function test_get_term_field_slug_when_slug_falls_back_from_name() { |
| 124 | | $name = rand_str( 15 ); |
| | 124 | $name = 'foobar'; |
| 125 | 125 | |
| 126 | 126 | $term = self::factory()->term->create_and_get( |
| 127 | 127 | array( |
| … |
… |
class Tests_Term_getTermField extends WP_UnitTestCase { |
| 156 | 156 | } |
| 157 | 157 | |
| 158 | 158 | public function test_get_term_field_description() { |
| 159 | | $desc = wpautop( rand_str() ); |
| | 159 | $desc = wpautop( 'foobar' ); |
| 160 | 160 | |
| 161 | 161 | $term = self::factory()->term->create_and_get( |
| 162 | 162 | array( |
-
diff --git a/tests/phpunit/tests/term/splitSharedTerm.php b/tests/phpunit/tests/term/splitSharedTerm.php
index 65cefe8c4a..b9a13662a0 100644
|
a
|
b
|
class Tests_Term_SplitSharedTerm extends WP_UnitTestCase { |
| 208 | 208 | array( '%d' ) |
| 209 | 209 | ); |
| 210 | 210 | |
| 211 | | $menu_id = wp_create_nav_menu( rand_str() ); |
| | 211 | $menu_id = wp_create_nav_menu( 'foobar' ); |
| 212 | 212 | $cat_menu_item = wp_update_nav_menu_item( |
| 213 | 213 | $menu_id, |
| 214 | 214 | 0, |
-
diff --git a/tests/phpunit/tests/term/termExists.php b/tests/phpunit/tests/term/termExists.php
index 8b57d67cd9..82027bc017 100644
|
a
|
b
|
class Tests_TermExists extends WP_UnitTestCase { |
| 260 | 260 | register_taxonomy( 'wptests_tax', 'post' ); |
| 261 | 261 | |
| 262 | 262 | // Insert a term. |
| 263 | | $term = rand_str(); |
| | 263 | $term = 'term'; |
| 264 | 264 | $t = wp_insert_term( $term, 'wptests_tax' ); |
| 265 | 265 | $this->assertIsArray( $t ); |
| 266 | 266 | $this->assertEquals( $t['term_id'], term_exists( $t['term_id'] ) ); |
| … |
… |
class Tests_TermExists extends WP_UnitTestCase { |
| 272 | 272 | } |
| 273 | 273 | |
| 274 | 274 | function test_term_exists_unknown() { |
| 275 | | $this->assertNull( term_exists( rand_str() ) ); |
| | 275 | $this->assertNull( term_exists( 'foobar' ) ); |
| 276 | 276 | $this->assertSame( 0, term_exists( 0 ) ); |
| 277 | 277 | $this->assertNull( term_exists( '' ) ); |
| 278 | 278 | $this->assertNull( term_exists( null ) ); |
-
diff --git a/tests/phpunit/tests/term/wpSetObjectTerms.php b/tests/phpunit/tests/term/wpSetObjectTerms.php
index 1db10a651c..7bfa9edaa7 100644
|
a
|
b
|
class Tests_Term_WpSetObjectTerms extends WP_UnitTestCase { |
| 15 | 15 | * @ticket 26570 |
| 16 | 16 | */ |
| 17 | 17 | function test_set_object_terms() { |
| 18 | | $non_hier = rand_str( 10 ); |
| 19 | | $hier = rand_str( 10 ); |
| | 18 | $non_hier = 'bar'; |
| | 19 | $hier = 'baz'; |
| 20 | 20 | |
| 21 | 21 | // Register taxonomies. |
| 22 | 22 | register_taxonomy( $non_hier, array() ); |
| … |
… |
class Tests_Term_WpSetObjectTerms extends WP_UnitTestCase { |
| 133 | 133 | $ids = self::$post_ids; |
| 134 | 134 | |
| 135 | 135 | $terms = array( |
| 136 | | rand_str(), |
| 137 | | rand_str(), |
| 138 | | rand_str(), |
| | 136 | 'term0', |
| | 137 | 'term1', |
| | 138 | 'term2', |
| 139 | 139 | ); |
| 140 | 140 | |
| 141 | 141 | foreach ( $ids as $id ) { |
| … |
… |
class Tests_Term_WpSetObjectTerms extends WP_UnitTestCase { |
| 164 | 164 | |
| 165 | 165 | function test_set_object_terms_invalid() { |
| 166 | 166 | // Bogus taxonomy. |
| 167 | | $result = wp_set_object_terms( self::$post_ids[0], array( rand_str() ), rand_str() ); |
| | 167 | $result = wp_set_object_terms( self::$post_ids[0], array( 'foo' ), 'bar' ); |
| 168 | 168 | $this->assertWPError( $result ); |
| 169 | 169 | } |
| 170 | 170 | |
-
diff --git a/tests/phpunit/tests/term/wpTaxonomy.php b/tests/phpunit/tests/term/wpTaxonomy.php
index a8689284c2..29c51fb0af 100644
|
a
|
b
|
class Tests_WP_Taxonomy extends WP_UnitTestCase { |
| 18 | 18 | /* @var WP $wp */ |
| 19 | 19 | global $wp; |
| 20 | 20 | |
| 21 | | $taxonomy = rand_str(); |
| | 21 | $taxonomy = 'taxonomy'; |
| 22 | 22 | $taxonomy_object = new WP_Taxonomy( $taxonomy, 'post' ); |
| 23 | 23 | |
| 24 | 24 | $taxonomy_object->add_rewrite_rules(); |
| … |
… |
class Tests_WP_Taxonomy extends WP_UnitTestCase { |
| 31 | 31 | /* @var WP $wp */ |
| 32 | 32 | global $wp; |
| 33 | 33 | |
| 34 | | $taxonomy = rand_str(); |
| | 34 | $taxonomy = 'taxonomy'; |
| 35 | 35 | $taxonomy_object = new WP_Taxonomy( |
| 36 | 36 | $taxonomy, |
| 37 | 37 | 'post', |
| … |
… |
class Tests_WP_Taxonomy extends WP_UnitTestCase { |
| 58 | 58 | /* @var WP_Rewrite $wp_rewrite */ |
| 59 | 59 | global $wp_rewrite; |
| 60 | 60 | |
| 61 | | $taxonomy = rand_str(); |
| | 61 | $taxonomy = 'taxonomy'; |
| 62 | 62 | $taxonomy_object = new WP_Taxonomy( |
| 63 | 63 | $taxonomy, |
| 64 | 64 | 'post', |
| … |
… |
class Tests_WP_Taxonomy extends WP_UnitTestCase { |
| 79 | 79 | } |
| 80 | 80 | |
| 81 | 81 | public function test_adds_ajax_callback() { |
| 82 | | $taxonomy = rand_str(); |
| | 82 | $taxonomy = 'taxonomy'; |
| 83 | 83 | $taxonomy_object = new WP_Taxonomy( |
| 84 | 84 | $taxonomy, |
| 85 | 85 | 'post', |
-
diff --git a/tests/phpunit/tests/theme.php b/tests/phpunit/tests/theme.php
index 62cadb62b0..2720eebdde 100644
|
a
|
b
|
class Tests_Theme extends WP_UnitTestCase { |
| 298 | 298 | // get_query_template() |
| 299 | 299 | |
| 300 | 300 | // Template file that doesn't exist. |
| 301 | | $this->assertSame( '', get_query_template( rand_str() ) ); |
| | 301 | $this->assertSame( '', get_query_template( 'foobar' ) ); |
| 302 | 302 | |
| 303 | 303 | // Template files that do exist. |
| 304 | 304 | /* |
| … |
… |
class Tests_Theme extends WP_UnitTestCase { |
| 332 | 332 | |
| 333 | 333 | function test_switch_theme_bogus() { |
| 334 | 334 | // Try switching to a theme that doesn't exist. |
| 335 | | $template = rand_str(); |
| 336 | | $style = rand_str(); |
| | 335 | $template = 'some_template'; |
| | 336 | $style = 'some_style'; |
| 337 | 337 | update_option( 'template', $template ); |
| 338 | 338 | update_option( 'stylesheet', $style ); |
| 339 | 339 | |
-
diff --git a/tests/phpunit/tests/user.php b/tests/phpunit/tests/user.php
index c7a04779cd..62ac00dd77 100644
|
a
|
b
|
class Tests_User extends WP_UnitTestCase { |
| 93 | 93 | |
| 94 | 94 | // Simple get/set tests for user_option functions. |
| 95 | 95 | function test_user_option() { |
| 96 | | $key = rand_str(); |
| 97 | | $val = rand_str(); |
| | 96 | $key = 'foo'; |
| | 97 | $val = 'bar'; |
| 98 | 98 | |
| 99 | 99 | // Get an option that doesn't exist. |
| 100 | 100 | $this->assertFalse( get_user_option( $key, self::$author_id ) ); |
| … |
… |
class Tests_User extends WP_UnitTestCase { |
| 104 | 104 | $this->assertSame( $val, get_user_option( $key, self::$author_id ) ); |
| 105 | 105 | |
| 106 | 106 | // Change and get again. |
| 107 | | $val2 = rand_str(); |
| | 107 | $val2 = 'baz'; |
| 108 | 108 | update_user_option( self::$author_id, $key, $val2 ); |
| 109 | 109 | $this->assertSame( $val2, get_user_option( $key, self::$author_id ) ); |
| 110 | 110 | } |
| … |
… |
class Tests_User extends WP_UnitTestCase { |
| 135 | 135 | // Delete by key AND value. |
| 136 | 136 | update_user_meta( self::$author_id, $key, $val ); |
| 137 | 137 | // Incorrect key: key still exists. |
| 138 | | delete_user_meta( self::$author_id, $key, rand_str() ); |
| | 138 | delete_user_meta( self::$author_id, $key, 'foo' ); |
| 139 | 139 | $this->assertSame( $val, get_user_meta( self::$author_id, $key, true ) ); |
| 140 | 140 | // Correct key: deleted. |
| 141 | 141 | delete_user_meta( self::$author_id, $key, $val ); |
| … |
… |
class Tests_User extends WP_UnitTestCase { |
| 149 | 149 | function test_usermeta_array() { |
| 150 | 150 | // Some values to set. |
| 151 | 151 | $vals = array( |
| 152 | | rand_str() => 'val-' . rand_str(), |
| 153 | | rand_str() => 'val-' . rand_str(), |
| 154 | | rand_str() => 'val-' . rand_str(), |
| | 152 | 'key0' => 'val0', |
| | 153 | 'key1' => 'val1', |
| | 154 | 'key2' => 'val2', |
| 155 | 155 | ); |
| 156 | 156 | |
| 157 | 157 | // There is already some stuff in the array. |
| … |
… |
class Tests_User extends WP_UnitTestCase { |
| 475 | 475 | $post = array( |
| 476 | 476 | 'post_author' => self::$author_id, |
| 477 | 477 | 'post_status' => 'publish', |
| 478 | | 'post_content' => rand_str(), |
| 479 | | 'post_title' => rand_str(), |
| | 478 | 'post_content' => 'content', |
| | 479 | 'post_title' => 'title', |
| 480 | 480 | 'post_type' => 'post', |
| 481 | 481 | ); |
| 482 | 482 | |
| … |
… |
class Tests_User extends WP_UnitTestCase { |
| 636 | 636 | function test_user_meta_error() { |
| 637 | 637 | $id1 = wp_insert_user( |
| 638 | 638 | array( |
| 639 | | 'user_login' => rand_str(), |
| | 639 | 'user_login' => 'taco_burrito', |
| 640 | 640 | 'user_pass' => 'password', |
| 641 | 641 | 'user_email' => 'taco@burrito.com', |
| 642 | 642 | ) |
| … |
… |
class Tests_User extends WP_UnitTestCase { |
| 645 | 645 | |
| 646 | 646 | $id2 = wp_insert_user( |
| 647 | 647 | array( |
| 648 | | 'user_login' => rand_str(), |
| | 648 | 'user_login' => 'taco_burrito2', |
| 649 | 649 | 'user_pass' => 'password', |
| 650 | 650 | 'user_email' => 'taco@burrito.com', |
| 651 | 651 | ) |
| … |
… |
class Tests_User extends WP_UnitTestCase { |
| 826 | 826 | */ |
| 827 | 827 | public function test_wp_insert_user_should_not_wipe_existing_password() { |
| 828 | 828 | $user_details = array( |
| 829 | | 'user_login' => rand_str(), |
| | 829 | 'user_login' => 'jonsnow', |
| 830 | 830 | 'user_pass' => 'password', |
| 831 | | 'user_email' => rand_str() . '@example.com', |
| | 831 | 'user_email' => 'jonsnow@example.com', |
| 832 | 832 | ); |
| 833 | 833 | |
| 834 | 834 | $user_id = wp_insert_user( $user_details ); |
-
diff --git a/tests/phpunit/tests/user/author.php b/tests/phpunit/tests/user/author.php
index 1dd92a486d..4828bf7d49 100644
|
a
|
b
|
class Tests_User_Author_Template extends WP_UnitTestCase { |
| 26 | 26 | array( |
| 27 | 27 | 'post_author' => self::$author_id, |
| 28 | 28 | 'post_status' => 'publish', |
| 29 | | 'post_content' => rand_str(), |
| 30 | | 'post_title' => rand_str(), |
| | 29 | 'post_content' => 'content', |
| | 30 | 'post_title' => 'title', |
| 31 | 31 | 'post_type' => 'post', |
| 32 | 32 | ) |
| 33 | 33 | ); |
-
diff --git a/tests/phpunit/tests/xmlrpc/wp/editProfile.php b/tests/phpunit/tests/xmlrpc/wp/editProfile.php
index 570de27220..5a69f82823 100644
|
a
|
b
|
class Tests_XMLRPC_wp_editProfile extends WP_XMLRPC_UnitTestCase { |
| 16 | 16 | $subscriber_id = $this->make_user_by_role( 'subscriber' ); |
| 17 | 17 | |
| 18 | 18 | $new_data = array( |
| 19 | | 'first_name' => rand_str(), |
| 20 | | 'last_name' => rand_str(), |
| | 19 | 'first_name' => 'firstname', |
| | 20 | 'last_name' => 'lastname', |
| 21 | 21 | 'url' => 'http://www.example.org/subscriber', |
| 22 | | 'display_name' => rand_str(), |
| 23 | | 'nickname' => rand_str(), |
| 24 | | 'nicename' => rand_str(), |
| 25 | | 'bio' => rand_str( 200 ), |
| | 22 | 'display_name' => 'displayname', |
| | 23 | 'nickname' => 'nickname', |
| | 24 | 'nicename' => 'nicename', |
| | 25 | 'bio' => 'Lorem ipsum dolor sit amet, consectetur adipiscing elit.', |
| 26 | 26 | ); |
| 27 | 27 | $result = $this->myxmlrpcserver->wp_editProfile( array( 1, 'subscriber', 'subscriber', $new_data ) ); |
| 28 | 28 | $this->assertNotIXRError( $result ); |
-
diff --git a/tests/phpunit/tests/xmlrpc/wp/getComment.php b/tests/phpunit/tests/xmlrpc/wp/getComment.php
index 1f9b7cd9f5..cfc3a86b29 100644
|
a
|
b
|
class Tests_XMLRPC_wp_getComment extends WP_XMLRPC_UnitTestCase { |
| 18 | 18 | 'comment_author' => 'Test commenter', |
| 19 | 19 | 'comment_author_url' => 'http://example.com/', |
| 20 | 20 | 'comment_author_email' => 'example@example.com', |
| 21 | | 'comment_content' => rand_str( 100 ), |
| | 21 | 'comment_content' => 'Lorem ipsum dolor sit amet, consectetur adipiscing elit.', |
| 22 | 22 | ); |
| 23 | 23 | self::$parent_comment_id = wp_insert_comment( self::$parent_comment_data ); |
| 24 | 24 | |
| … |
… |
class Tests_XMLRPC_wp_getComment extends WP_XMLRPC_UnitTestCase { |
| 28 | 28 | 'comment_author_url' => 'http://example.org/', |
| 29 | 29 | 'comment_author_email' => 'example@example.org', |
| 30 | 30 | 'comment_parent' => self::$parent_comment_id, |
| 31 | | 'comment_content' => rand_str( 100 ), |
| | 31 | 'comment_content' => 'Duis non neque cursus, commodo massa in, bibendum nisl.', |
| 32 | 32 | ); |
| 33 | 33 | self::$child_comment_id = wp_insert_comment( self::$child_comment_data ); |
| 34 | 34 | } |
-
diff --git a/tests/phpunit/tests/xmlrpc/wp/getPost.php b/tests/phpunit/tests/xmlrpc/wp/getPost.php
index 1480543b43..280d6aaea7 100644
|
a
|
b
|
class Tests_XMLRPC_wp_getPost extends WP_XMLRPC_UnitTestCase { |
| 14 | 14 | |
| 15 | 15 | $this->post_date_ts = strtotime( '+1 day' ); |
| 16 | 16 | $this->post_data = array( |
| 17 | | 'post_title' => rand_str(), |
| 18 | | 'post_content' => rand_str( 2000 ), |
| 19 | | 'post_excerpt' => rand_str( 100 ), |
| | 17 | 'post_title' => 'Post Title', |
| | 18 | 'post_content' => 'Lorem ipsum dolor sit amet, consectetur adipiscing elit.', |
| | 19 | 'post_excerpt' => 'Post Excerpt', |
| 20 | 20 | 'post_author' => $this->make_user_by_role( 'author' ), |
| 21 | 21 | 'post_date' => date_format( date_create( "@{$this->post_date_ts}" ), 'Y-m-d H:i:s' ), |
| 22 | 22 | ); |
-
diff --git a/tests/phpunit/tests/xmlrpc/wp/newComment.php b/tests/phpunit/tests/xmlrpc/wp/newComment.php
index fb4ebca568..d3d426125d 100644
|
a
|
b
|
class Tests_XMLRPC_wp_newComment extends WP_XMLRPC_UnitTestCase { |
| 55 | 55 | 'administrator', |
| 56 | 56 | self::$posts['publish']->ID, |
| 57 | 57 | array( |
| 58 | | 'content' => rand_str( 100 ), |
| | 58 | 'content' => 'Content', |
| 59 | 59 | ), |
| 60 | 60 | ) |
| 61 | 61 | ); |
| … |
… |
class Tests_XMLRPC_wp_newComment extends WP_XMLRPC_UnitTestCase { |
| 155 | 155 | 'administrator', |
| 156 | 156 | $post->ID, |
| 157 | 157 | array( |
| 158 | | 'content' => rand_str( 100 ), |
| | 158 | 'content' => 'Content', |
| 159 | 159 | ), |
| 160 | 160 | ) |
| 161 | 161 | ); |
| … |
… |
class Tests_XMLRPC_wp_newComment extends WP_XMLRPC_UnitTestCase { |
| 171 | 171 | 'administrator', |
| 172 | 172 | self::$posts['publish']->ID, |
| 173 | 173 | array( |
| 174 | | 'content' => rand_str( 100 ), |
| | 174 | 'content' => 'Content', |
| 175 | 175 | ), |
| 176 | 176 | ); |
| 177 | 177 | |