Make WordPress Core

Changeset 54036


Ignore:
Timestamp:
08/31/2022 10:11:30 AM (2 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.

Location:
trunk/tests/phpunit
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • trunk/tests/phpunit/data/languages/themes/block-theme-pl_PL.po

    r52049 r54036  
    33"Project-Id-Version: \n"
    44"POT-Creation-Date: 2015-12-31 16:31+0100\n"
    5 "PO-Revision-Date: 2021-03-15 13:10+0100\n"
     5"PO-Revision-Date: 2022-08-31 11:08+0200\n"
     6"Last-Translator: \n"
     7"Language-Team: \n"
    68"Language: pl_PL\n"
    79"MIME-Version: 1.0\n"
    810"Content-Type: text/plain; charset=UTF-8\n"
    911"Content-Transfer-Encoding: 8bit\n"
    10 "X-Generator: Poedit 2.4.2\n"
     12"Plural-Forms: nplurals=2; plural=(n != 1);\n"
     13"X-Generator: Poedit 3.1.1\n"
    1114"X-Poedit-Basepath: .\n"
    12 "Plural-Forms: nplurals=2; plural=(n != 1);\n"
    1315"X-Poedit-KeywordsList: __;_e;_x:1,2c;_ex:1,2c;_n:1,2;_nx:1,2,4c;_n_noop:1,2;"
    1416"_nx_noop:1,2,3c;esc_attr__;esc_html__;esc_attr_e;esc_html_e;esc_attr_x:1,2c;"
    1517"esc_html_x:1,2c\n"
    1618"X-Textdomain-Support: yes\n"
    17 "Last-Translator: \n"
    18 "Language-Team: \n"
    1919"X-Poedit-SearchPath-0: .\n"
     20
     21msgctxt "Style variation name"
     22msgid "Block theme"
     23msgstr "Motyw blokowy"
     24
     25msgctxt "Style variation name"
     26msgid "Block theme variation"
     27msgstr "Wariant motywu blokowego"
    2028
    2129msgctxt "Custom template name"
  • trunk/tests/phpunit/data/themedir1/block-theme/styles/variation.json

    r53072 r54036  
    11{
    2     "version": 2,
    3     "settings": {
    4         "color": {
    5             "palette": [
    6                 {
    7                     "slug": "foreground",
    8                     "color": "#3F67C6",
    9                     "name": "Foreground"
    10                 }
    11             ]
    12         }
    13     },
    14     "styles": {
    15         "blocks": {
    16             "core/post-title": {
    17                 "typography": {
    18                     "fontWeight": "700"
    19                 }
    20             }
    21         }
    22     }
     2    "version": 2,
     3    "title": "Block theme variation",
     4    "settings": {
     5        "color": {
     6            "palette": [
     7                {
     8                    "slug": "foreground",
     9                    "color": "#3F67C6",
     10                    "name": "Foreground"
     11                }
     12            ]
     13        }
     14    },
     15    "styles": {
     16        "blocks": {
     17            "core/post-title": {
     18                "typography": {
     19                    "fontWeight": "700"
     20                }
     21            }
     22        }
     23    }
    2324}
  • trunk/tests/phpunit/data/themedir1/block-theme/theme.json

    r52049 r54036  
    11{
    22    "version": 1,
     3    "title": "Block theme",
    34    "settings": {
    45        "color": {
     
    3738        },
    3839        "spacing": {
    39             "units": [
    40                 "rem"
    41             ],
     40            "units": ["rem"],
    4241            "customPadding": true
    4342        },
  • trunk/tests/phpunit/tests/rest-api/rest-global-styles-controller.php

    r53921 r54036  
    472472            array(
    473473                'version'  => 2,
     474                'title'    => 'Block theme variation',
    474475                'settings' => array(
    475476                    'color' => array(
     
    494495                    ),
    495496                ),
    496                 'title'    => 'variation',
    497497            ),
    498498        );
  • 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.