Make WordPress Core


Ignore:
Timestamp:
12/04/2016 05:31:28 PM (8 years ago)
Author:
westonruter
Message:

Customize: Ensure a custom_css post insertion gets an initial post revision.

Merges [39477] onto 4.7 branch.
Props georgestephanis, westonruter.
Fixes #39032 for 4.7.

Location:
branches/4.7
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • branches/4.7

  • branches/4.7/tests/phpunit/tests/customize/custom-css-setting.php

    r39350 r39479  
    194194
    195195    /**
     196     * Test revision saving on initial save of Custom CSS.
     197     *
     198     * @ticket 39032
     199     */
     200    function test_custom_css_revision_saved() {
     201        $inserted_css = 'body { background: black; }';
     202        $updated_css = 'body { background: red; }';
     203
     204        $post = wp_update_custom_css_post( $inserted_css, array(
     205            'stylesheet' => 'testtheme',
     206        ) );
     207
     208        $this->assertSame( $inserted_css, $post->post_content );
     209        $revisions = array_values( wp_get_post_revisions( $post ) );
     210        $this->assertCount( 1, $revisions );
     211        $this->assertSame( $inserted_css, $revisions[0]->post_content );
     212
     213        wp_update_custom_css_post( $updated_css, array(
     214            'stylesheet' => 'testtheme',
     215        ) );
     216
     217        $revisions = array_values( wp_get_post_revisions( $post ) );
     218        $this->assertCount( 2, $revisions );
     219        $this->assertSame( $updated_css, $revisions[0]->post_content );
     220        $this->assertSame( $inserted_css, $revisions[1]->post_content );
     221    }
     222
     223    /**
    196224     * Test crud methods on WP_Customize_Custom_CSS_Setting.
    197225     *
Note: See TracChangeset for help on using the changeset viewer.