Make WordPress Core


Ignore:
Timestamp:
08/31/2022 10:11:30 AM (4 years ago)
Author:
gziolo
Message:

Tests: Increase coverage for translations applied to theme.json

Ensures that translations are correctly applied to the title field in the theme.json and all style variations located in the them inside the styles folder.

Follow-up #55495, [53038].
See also #54336.

File:
1 edited

Legend:

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

    r53916 r54036  
    8383
    8484                switch_theme( 'block-theme' );
    85                 $actual = WP_Theme_JSON_Resolver::get_theme_data();
     85                $theme_data       = WP_Theme_JSON_Resolver::get_theme_data();
     86                $style_variations = WP_Theme_JSON_Resolver::get_style_variations();
    8687
    8788                unload_textdomain( 'block-theme' );
    8889                remove_filter( 'locale', array( $this, 'filter_set_locale_to_polish' ) );
    8990
    90                 $this->assertSame( wp_get_theme()->get( 'TextDomain' ), 'block-theme' );
    91                 $this->assertSame(
     91                $this->assertSame( 'block-theme', wp_get_theme()->get( 'TextDomain' ) );
     92                $this->assertSame( 'Motyw blokowy', $theme_data->get_data()['title'] );
     93                $this->assertSameSets(
    9294                        array(
    9395                                'color'      => array(
    … …  
    151153                                ),
    152154                        ),
    153                         $actual->get_settings()
    154                 );
    155                 $this->assertSame(
    156                         $actual->get_custom_templates(),
     155                        $theme_data->get_settings()
     156                );
     157                $this->assertSameSets(
    157158                        array(
    158159                                'page-home' => array(
    … …  
    160161                                        'postTypes' => array( 'page' ),
    161162                                ),
    162                         )
    163                 );
    164                 $this->assertSame(
    165                         $actual->get_template_parts(),
     163                        ),
     164                        $theme_data->get_custom_templates()
     165                );
     166                $this->assertSameSets(
    166167                        array(
    167168                                'small-header' => array(
    … …  
    169170                                        'area'  => 'header',
    170171                                ),
    171                         )
     172                        ),
     173                        $theme_data->get_template_parts()
     174                );
     175                $this->assertSame(
     176                        'Wariant motywu blokowego',
     177                        $style_variations[0]['title']
    172178                );
    173179        }
Note: See TracChangeset for help on using the changeset viewer.