WordPress.org

Make WordPress Core

Changeset 682 in tests


Ignore:
Timestamp:
04/12/2012 05:51:09 PM (6 years ago)
Author:
kurtpayne
Message:

Make assertions about timestamp responses more robust. Enabled a test that was accidentally disabled because the method name didn't start with "test."

File:
1 edited

Legend:

Unmodified
Added
Removed
  • wp-testcase/test-ajax-actions/test_admin_ajax_dim_comments.php

    r649 r682  
    173173     * @return void
    174174     */
    175     public function _test_with_bad_id( $comment ) {
     175    public function test_with_bad_id( $comment ) {
    176176       
    177177        // Reset request
     
    189189        $_POST['_url']        = admin_url( 'edit-comments.php' );
    190190
    191         // Make the request
    192         $this->setExpectedException( 'WPAjaxDieException', (string) time() );
    193         $this->_handleAjax( 'dim-comment' );
     191        // Make the request, look for a timestamp in the exception
     192        try {
     193            $this->_handleAjax( 'dim-comment' );
     194            $this->fail( 'Expected exception: WPAjaxDieException' );
     195        } catch ( WPAjaxDieException $e ) {
     196            $this->assertEquals( 10, strlen( $e->getMessage() ) );
     197            $this->assertTrue( is_numeric( $e->getMessage() ) );
     198        } catch ( Exception $e ) {
     199            $this->fail( 'Unexpected exception type: ' . get_class( $e ) );
     200        }
    194201    }
    195202
Note: See TracChangeset for help on using the changeset viewer.