WordPress.org

Make WordPress Core


Ignore:
Timestamp:
12/04/2016 05:28:27 PM (19 months ago)
Author:
westonruter
Message:

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

Props georgestephanis, westonruter.
See #30854, #38672, #35395.
Fixes #39032.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/tests/phpunit/tests/customize/custom-css-setting.php

    r39350 r39477  
    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.