From f17e457a160503e23ce8167beee193593d52cd74 Mon Sep 17 00:00:00 2001 From: Aaron Jorbin Date: Tue, 6 Oct 2015 19:55:56 +0000 Subject: [PATCH] Add message with status info to temperamental assertion. The ajax delete comment tests are intermittently failing. Many of the assertions make it hard to tell why they are failing. This adds a message to one of those assertions that contains some info on what is being asserted with the goal that it helps developers understand why the failure is failing. See #33968 git-svn-id: https://develop.svn.wordpress.org/trunk@34879 602fd350-edb4-49c9-b593-d223f7449a82 --- tests/phpunit/tests/ajax/DeleteComment.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tests/phpunit/tests/ajax/DeleteComment.php b/tests/phpunit/tests/ajax/DeleteComment.php index 97a2c02660..a7a1597498 100644 --- a/tests/phpunit/tests/ajax/DeleteComment.php +++ b/tests/phpunit/tests/ajax/DeleteComment.php @@ -101,7 +101,8 @@ class Tests_Ajax_DeleteComment extends WP_Ajax_UnitTestCase { $recalc_total = $comment_count->total_comments; // Check for either possible total - $this->assertTrue( in_array( (int) $xml->response[0]->comment[0]->supplemental[0]->total[0] , array( $total, $recalc_total ) ) ); + $message = sprintf( 'returned value: %1$d $total: %2$d $recalc_total: %3$d', (int) $xml->response[0]->comment[0]->supplemental[0]->total[0], $total, $recalc_total ); + $this->assertTrue( in_array( (int) $xml->response[0]->comment[0]->supplemental[0]->total[0] , array( $total, $recalc_total ) ), $message ); } /**