Ticket #39032: 39032.with-tests.diff
| File 39032.with-tests.diff, 1.5 KB (added by , 9 years ago) |
|---|
-
src/wp-includes/theme.php
1786 1786 $r = wp_update_post( wp_slash( $post_data ), true ); 1787 1787 } else { 1788 1788 $r = wp_insert_post( wp_slash( $post_data ), true ); 1789 // Trigger creation of a revision. See #30854 1790 if ( ! is_wp_error( $r ) && 0 === count( wp_get_post_revisions( $r ) ) ) { 1791 wp_save_post_revision( $r ); 1792 } 1789 1793 } 1790 1794 1791 if ( $r instanceof WP_Error) {1795 if ( is_wp_error( $r ) ) { 1792 1796 return $r; 1793 1797 } 1794 1798 return get_post( $r ); -
tests/phpunit/tests/customize/custom-css-setting.php
193 193 } 194 194 195 195 /** 196 * Test revision saving on initial save of Custom CSS. 197 * 198 * @ticket 39032 199 */ 200 function test_custom_css_revision_saved() { 201 $r = wp_update_custom_css_post( 'body { background: black; }', array( 202 'stylesheet' => 'testtheme', 203 ) ); 204 205 $this->assertCount( 1, wp_get_post_revisions( $r ) ); 206 207 wp_update_custom_css_post( 'body { background: red; }', array( 208 'stylesheet' => 'testtheme', 209 ) ); 210 211 $this->assertCount( 2, wp_get_post_revisions( $r ) ); 212 } 213 214 /** 196 215 * Test crud methods on WP_Customize_Custom_CSS_Setting. 197 216 * 198 217 * @covers WP_Customize_Custom_CSS_Setting::value()