From 6ced366e7c595ae2982eb032fe005ad6d815fb63 Mon Sep 17 00:00:00 2001 From: Scott Taylor Date: Thu, 12 Sep 2013 04:59:29 +0000 Subject: [PATCH] Add a `post_id` fixture in `test/meta/slashes.php` so `Undefined variable: comment_post_ID` notices don't fire when creating comments. See #25282. git-svn-id: https://develop.svn.wordpress.org/trunk@25383 602fd350-edb4-49c9-b593-d223f7449a82 --- tests/phpunit/tests/meta/slashes.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/tests/phpunit/tests/meta/slashes.php b/tests/phpunit/tests/meta/slashes.php index bcd59ba6a0..2f402eb604 100644 --- a/tests/phpunit/tests/meta/slashes.php +++ b/tests/phpunit/tests/meta/slashes.php @@ -9,6 +9,7 @@ class Tests_Meta_Slashes extends WP_UnitTestCase { function setUp() { parent::setUp(); $this->author_id = $this->factory->user->create( array( 'role' => 'editor' ) ); + $this->post_id = $this->factory->post->create(); $this->old_current_user = get_current_user_id(); wp_set_current_user( $this->author_id ); @@ -173,7 +174,7 @@ class Tests_Meta_Slashes extends WP_UnitTestCase { * */ function test_add_comment_meta() { - $id = $this->factory->comment->create(); + $id = $this->factory->comment->create( array( 'comment_post_ID' => $this->post_id ) ); add_comment_meta( $id, 'slash_test_1', $this->slash_1 ); add_comment_meta( $id, 'slash_test_2', $this->slash_3 ); @@ -197,7 +198,7 @@ class Tests_Meta_Slashes extends WP_UnitTestCase { * */ function test_update_comment_meta() { - $id = $this->factory->comment->create(); + $id = $this->factory->comment->create( array( 'comment_post_ID' => $this->post_id ) ); add_comment_meta( $id, 'slash_test_1', 'foo' ); add_comment_meta( $id, 'slash_test_2', 'foo' );