Make WordPress Core


Ignore:
Timestamp:
10/10/2022 02:52:21 PM (3 years ago)
Author:
audrasjb
Message:

Build/Test Tools: Expand unit tests for theme.json.

This changeset adds unit test coverage for the following features:

  • Gradients
  • filter (Duotones)
  • blockGap
  • shadow
  • useRootPaddingAwareAlignments
  • appearanceTools

Props gunterer, johnregan3, audrasjb, mukesh27.
Fixes #56611.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/tests/phpunit/tests/theme/wpThemeJsonResolver.php

    r54402 r54443  
    7777     * @ticket 52991
    7878     * @ticket 54336
     79     * @ticket 56611
    7980     */
    8081    public function test_translations_are_applied() {
     
    119120                        ),
    120121                    ),
     122                    'duotone'        => array(
     123                        'theme' => array(
     124                            array(
     125                                'colors' => array( '#333333', '#aaaaaa' ),
     126                                'slug'   => 'custom-duotone',
     127                                'name'   => 'Custom Duotone',
     128                            ),
     129                        ),
     130                    ),
    121131                ),
    122132                'typography' => array(
     
    134144                ),
    135145                'spacing'    => array(
    136                     'units'   => array( 'rem' ),
    137                     'padding' => true,
     146                    'units'    => array( 'rem' ),
     147                    'padding'  => true,
     148                    'blockGap' => true,
    138149                ),
    139150                'blocks'     => array(
     
    245256    /**
    246257     * @ticket 54336
     258     * @ticket 56611
    247259     */
    248260    function test_merges_child_theme_json_into_parent_theme_json() {
     
    254266                'custom'         => false,
    255267                'customGradient' => false,
     268                'duotone'        => array(
     269                    'theme' => array(
     270                        array(
     271                            'colors' => array( '#333333', '#aaaaaa' ),
     272                            'name'   => 'Custom Duotone',
     273                            'slug'   => 'custom-duotone',
     274                        ),
     275                    ),
     276                ),
    256277                'gradients'      => array(
    257278                    'theme' => array(
     
    298319            ),
    299320            'spacing'    => array(
    300                 'units'   => array( 'rem' ),
    301                 'padding' => true,
     321                'blockGap' => true,
     322                'units'    => array( 'rem' ),
     323                'padding'  => true,
    302324            ),
    303325            'blocks'     => array(
     
    367389        }
    368390        $query_count = count( $this->queries ) - $query_count;
    369         $this->assertSame( 0, $query_count, 'Unexpected SQL queries detected for the wp_global_style post type' );
     391        $this->assertEquals( 0, $query_count, 'Unexpected SQL queries detected for the wp_global_style post type' );
    370392
    371393        $user_cpt = WP_Theme_JSON_Resolver::get_user_data_from_wp_global_styles( $theme );
     
    382404        }
    383405        $query_count = count( $this->queries ) - $query_count;
    384         $this->assertSame( 0, $query_count, 'Unexpected SQL queries detected for the wp_global_style post type' );
     406        $this->assertEquals( 0, $query_count, 'Unexpected SQL queries detected for the wp_global_style post type' );
    385407        remove_filter( 'query', array( $this, 'filter_db_query' ) );
    386408    }
Note: See TracChangeset for help on using the changeset viewer.