mirror of
https://github.com/gosticks/wordpress-develop.git
synced 2026-04-05 13:14:29 +00:00
Build/Test Tools: Continue eliminating randomness in tests.
See [38762] See #37371 git-svn-id: https://develop.svn.wordpress.org/trunk@38763 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
@@ -127,11 +127,11 @@ class Tests_Comment extends WP_UnitTestCase {
|
||||
public function test_wp_new_comment_respects_dates() {
|
||||
$data = array(
|
||||
'comment_post_ID' => self::$post_id,
|
||||
'comment_author' => rand_str(),
|
||||
'comment_author' => 'Comment Author',
|
||||
'comment_author_url' => '',
|
||||
'comment_author_email' => '',
|
||||
'comment_type' => '',
|
||||
'comment_content' => rand_str(),
|
||||
'comment_content' => 'Comment',
|
||||
'comment_date' => '2011-01-01 10:00:00',
|
||||
'comment_date_gmt' => '2011-01-01 10:00:00',
|
||||
);
|
||||
@@ -150,12 +150,12 @@ class Tests_Comment extends WP_UnitTestCase {
|
||||
public function test_wp_new_comment_respects_author_ip() {
|
||||
$data = array(
|
||||
'comment_post_ID' => self::$post_id,
|
||||
'comment_author' => rand_str(),
|
||||
'comment_author' => 'Comment Author',
|
||||
'comment_author_IP' => '192.168.1.1',
|
||||
'comment_author_url' => '',
|
||||
'comment_author_email' => '',
|
||||
'comment_type' => '',
|
||||
'comment_content' => rand_str(),
|
||||
'comment_content' => 'Comment',
|
||||
);
|
||||
|
||||
$id = wp_new_comment( $data );
|
||||
@@ -171,12 +171,12 @@ class Tests_Comment extends WP_UnitTestCase {
|
||||
public function test_wp_new_comment_respects_author_ip_empty_string() {
|
||||
$data = array(
|
||||
'comment_post_ID' => self::$post_id,
|
||||
'comment_author' => rand_str(),
|
||||
'comment_author' => 'Comment Author',
|
||||
'comment_author_IP' => '',
|
||||
'comment_author_url' => '',
|
||||
'comment_author_email' => '',
|
||||
'comment_type' => '',
|
||||
'comment_content' => rand_str(),
|
||||
'comment_content' => 'Comment',
|
||||
);
|
||||
|
||||
$id = wp_new_comment( $data );
|
||||
@@ -192,13 +192,13 @@ class Tests_Comment extends WP_UnitTestCase {
|
||||
public function test_wp_new_comment_respects_comment_agent() {
|
||||
$data = array(
|
||||
'comment_post_ID' => self::$post_id,
|
||||
'comment_author' => rand_str(),
|
||||
'comment_author' => 'Comment Author',
|
||||
'comment_author_IP' => '',
|
||||
'comment_author_url' => '',
|
||||
'comment_author_email' => '',
|
||||
'comment_agent' => 'Mozilla/5.0 (iPhone; CPU iPhone OS 7_0 like Mac OS X; en-us) AppleWebKit/537.51.1 (KHTML, like Gecko) Version/7.0 Mobile/11A465 Safari/9537.53',
|
||||
'comment_type' => '',
|
||||
'comment_content' => rand_str(),
|
||||
'comment_content' => 'Comment',
|
||||
);
|
||||
|
||||
$id = wp_new_comment( $data );
|
||||
@@ -214,13 +214,13 @@ class Tests_Comment extends WP_UnitTestCase {
|
||||
public function test_wp_new_comment_should_trim_provided_comment_agent_to_254_chars() {
|
||||
$data = array(
|
||||
'comment_post_ID' => self::$post_id,
|
||||
'comment_author' => rand_str(),
|
||||
'comment_author' => 'Comment Author',
|
||||
'comment_author_IP' => '',
|
||||
'comment_author_url' => '',
|
||||
'comment_author_email' => '',
|
||||
'comment_agent' => 'Mozilla/5.0 (iPhone; CPU iPhone OS 7_0 like Mac OS X; en-us) AppleWebKit/537.51.1 (KHTML, like Gecko) Version/7.0 Mobile/11A465 Safari/9537.53 Opera/9.80 (X11; Linux i686; Ubuntu/14.10) Presto/2.12.388 Version/12.16 Mozilla/5.0 (Macintosh; U; PPC Mac OS X Mach-O; en; rv:1.8.1.4pre) Gecko/20070511 Camino/1.6pre',
|
||||
'comment_type' => '',
|
||||
'comment_content' => rand_str(),
|
||||
'comment_content' => 'Comment',
|
||||
);
|
||||
|
||||
$id = wp_new_comment( $data );
|
||||
@@ -236,13 +236,13 @@ class Tests_Comment extends WP_UnitTestCase {
|
||||
public function test_wp_new_comment_respects_comment_agent_empty_string() {
|
||||
$data = array(
|
||||
'comment_post_ID' => self::$post_id,
|
||||
'comment_author' => rand_str(),
|
||||
'comment_author' => 'Comment Author',
|
||||
'comment_author_IP' => '',
|
||||
'comment_author_url' => '',
|
||||
'comment_author_email' => '',
|
||||
'comment_agent' => '',
|
||||
'comment_type' => '',
|
||||
'comment_content' => rand_str(),
|
||||
'comment_content' => 'Comment',
|
||||
);
|
||||
|
||||
$id = wp_new_comment( $data );
|
||||
@@ -256,7 +256,7 @@ class Tests_Comment extends WP_UnitTestCase {
|
||||
public function test_comment_field_lengths() {
|
||||
$data = array(
|
||||
'comment_post_ID' => self::$post_id,
|
||||
'comment_author' => rand_str(),
|
||||
'comment_author' => 'Comment Author',
|
||||
'comment_author_url' => '',
|
||||
'comment_author_email' => '',
|
||||
'comment_type' => '',
|
||||
@@ -538,11 +538,11 @@ class Tests_Comment extends WP_UnitTestCase {
|
||||
// Moderators are notified when a new comment is added.
|
||||
$data = array(
|
||||
'comment_post_ID' => $post,
|
||||
'comment_author' => rand_str(),
|
||||
'comment_author' => 'Comment Author',
|
||||
'comment_author_url' => '',
|
||||
'comment_author_email' => '',
|
||||
'comment_type' => '',
|
||||
'comment_content' => rand_str(),
|
||||
'comment_content' => 'Comment',
|
||||
);
|
||||
wp_new_comment( $data );
|
||||
|
||||
@@ -588,11 +588,11 @@ class Tests_Comment extends WP_UnitTestCase {
|
||||
// Post authors are notified when a new comment is added to their post.
|
||||
$data = array(
|
||||
'comment_post_ID' => $post,
|
||||
'comment_author' => rand_str(),
|
||||
'comment_author' => 'Comment Author',
|
||||
'comment_author_url' => '',
|
||||
'comment_author_email' => '',
|
||||
'comment_type' => '',
|
||||
'comment_content' => rand_str(),
|
||||
'comment_content' => 'Comment',
|
||||
);
|
||||
wp_new_comment( $data );
|
||||
|
||||
@@ -638,13 +638,13 @@ class Tests_Comment extends WP_UnitTestCase {
|
||||
|
||||
$default_data = array(
|
||||
'comment_post_ID' => self::$post_id,
|
||||
'comment_author' => rand_str(),
|
||||
'comment_author' => 'Comment Author',
|
||||
'comment_author_IP' => '192.168.0.1',
|
||||
'comment_agent' => 'WRONG_AGENT',
|
||||
'comment_author_url' => '',
|
||||
'comment_author_email' => '',
|
||||
'comment_type' => '',
|
||||
'comment_content' => rand_str(),
|
||||
'comment_content' => 'Comment',
|
||||
);
|
||||
|
||||
$comment_id = wp_new_comment( $default_data );
|
||||
|
||||
Reference in New Issue
Block a user