WordPress.org

Make WordPress Core

Changeset 562 in tests


Ignore:
Timestamp:
03/05/12 18:37:26 (2 years ago)
Author:
kurtpayne
Message:

Updated unit test for #19855. Code is now run through htmlentities() and "\r" characters are removed.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • wp-testcase/test_includes_formatting.php

    r560 r562  
    625625    public function test_skip_pre_elements() { 
    626626        $this->knownWPBug( 19855 ); 
    627         $str = '<pre>' . file_get_contents( realpath( dirname( __FILE__ ) . '/../wp-testdata/formatting/sizzle.js' ) ) . '</pre>'; 
    628         $this->assertEquals( "<p>$str</p>", trim( wpautop( $str ) ) ); 
     627        $code = file_get_contents( realpath( dirname( __FILE__ ) . '/../wp-testdata/formatting/sizzle.js' ) ); 
     628        $code = str_replace( "\r", '', $code ); 
     629        $code = htmlentities( $code ); 
     630         
     631        // Not wrapped in <p> tags 
     632        $str = "<pre>$code</pre>"; 
     633        $this->assertEquals( $str, trim( wpautop( $str ) ) ); 
     634 
     635        // Text before/after is wrapped in <p> tags 
     636        $str = "Look at this code <pre>$code</pre> Isn't that cool?";        
     637        $this->assertEquals( '<p>Look at this code </p>' . "\n<pre>" . $code . "</pre>\n" . '<p> Isn\'t that cool?</p>', trim( wpautop( $str ) ) ); 
    629638    } 
    630639     
Note: See TracChangeset for help on using the changeset viewer.