Created
April 12, 2012 16:52
-
-
Save kurtpayne/2369072 to your computer and use it in GitHub Desktop.
Ajax exception timestamp assertions
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Index: wp-testcase/test-ajax-actions/test_admin_ajax_dim_comments.php | |
=================================================================== | |
--- wp-testcase/test-ajax-actions/test_admin_ajax_dim_comments.php (revision 676) | |
+++ wp-testcase/test-ajax-actions/test_admin_ajax_dim_comments.php (working copy) | |
@@ -188,9 +188,14 @@ | |
$_POST['_page'] = 1; | |
$_POST['_url'] = admin_url( 'edit-comments.php' ); | |
- // Make the request | |
- $this->setExpectedException( 'WPAjaxDieException', (string) time() ); | |
- $this->_handleAjax( 'dim-comment' ); | |
+ // Make the request, look for a timestamp in the exception | |
+ try { | |
+ $this->_handleAjax( 'dim-comment' ); | |
+ $this->fail( 'Expected exception' ); | |
+ } catch ( WPAjaxDieException $e ) { | |
+ $this->assertEquals( 10, strlen( $e->getMessage() ) ); | |
+ $this->assertInternalType( 'integer', $e->getMessage() ); | |
+ } | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment