<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[55172] trunk: Editor: Add support for editing block style variations in global styles.</title>
</head>
<body>

<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt;  }
#msg dl a { font-weight: bold}
#msg dl a:link    { color:#fc3; }
#msg dl a:active  { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { white-space: pre-line; overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff  {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta" style="font-size: 105%">
<dt style="float: left; width: 6em; font-weight: bold">Revision</dt> <dd><a style="font-weight: bold" href="https://core.trac.wordpress.org/changeset/55172">55172</a><script type="application/ld+json">{"@context":"http://schema.org","@type":"EmailMessage","description":"Review this Commit","action":{"@type":"ViewAction","url":"https://core.trac.wordpress.org/changeset/55172","name":"Review Commit"}}</script></dd>
<dt style="float: left; width: 6em; font-weight: bold">Author</dt> <dd>hellofromTonya</dd>
<dt style="float: left; width: 6em; font-weight: bold">Date</dt> <dd>2023-02-01 13:41:16 +0000 (Wed, 01 Feb 2023)</dd>
</dl>

<pre style='padding-left: 1em; margin: 2em 0; border-left: 2px solid #ccc; line-height: 1.25; font-size: 105%; font-family: sans-serif'>Editor: Add support for editing block style variations in global styles.

To allow editing of block style variations in global styles, this changeset adds the following for server side support:

* building of block style schema into `WP_Theme_JSON::sanitize()`.
* appending of style variation selectors to block metadata in `WP_Theme_JSON::get_blocks_metadata()`.
* building of selectors and variations for nodes in `WP_Theme_JSON::get_block_nodes()`.

Tests for happy and unhappy paths are included.

Reference:
* [https://github.com/WordPress/gutenberg/pull/46343 Gutenberg PR 46343]

Follow-up to <a href="https://core.trac.wordpress.org/changeset/54118">[54118]</a>, <a href="https://core.trac.wordpress.org/changeset/50973">[50973]</a>, <a href="https://core.trac.wordpress.org/changeset/50959">[50959]</a>.

Props isabel_brison, 
Fixes <a href="https://core.trac.wordpress.org/ticket/57583">#57583</a>.</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunksrcwpincludesclasswpthemejsonphp">trunk/src/wp-includes/class-wp-theme-json.php</a></li>
<li><a href="#trunktestsphpunitteststhemewpThemeJsonphp">trunk/tests/phpunit/tests/theme/wpThemeJson.php</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunksrcwpincludesclasswpthemejsonphp"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: trunk/src/wp-includes/class-wp-theme-json.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/src/wp-includes/class-wp-theme-json.php     2023-01-31 19:39:51 UTC (rev 55171)
+++ trunk/src/wp-includes/class-wp-theme-json.php       2023-02-01 13:41:16 UTC (rev 55172)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -665,9 +665,24 @@
</span><span class="cx" style="display: block; padding: 0 10px">                $schema_styles_blocks   = array();
</span><span class="cx" style="display: block; padding: 0 10px">                $schema_settings_blocks = array();
</span><span class="cx" style="display: block; padding: 0 10px">                foreach ( $valid_block_names as $block ) {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                        $schema_settings_blocks[ $block ]           = static::VALID_SETTINGS;
-                       $schema_styles_blocks[ $block ]             = $styles_non_top_level;
-                       $schema_styles_blocks[ $block ]['elements'] = $schema_styles_elements;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                 // Build the schema for each block style variation.
+                       $style_variation_names = array();
+                       if (
+                               ! empty( $input['styles']['blocks'][ $block ]['variations'] ) &&
+                               is_array( $input['styles']['blocks'][ $block ]['variations'] )
+                       ) {
+                               $style_variation_names = array_keys( $input['styles']['blocks'][ $block ]['variations'] );
+                       }
+
+                       $schema_styles_variations = array();
+                       if ( ! empty( $style_variation_names ) ) {
+                               $schema_styles_variations = array_fill_keys( $style_variation_names, $styles_non_top_level );
+                       }
+
+                       $schema_settings_blocks[ $block ]             = static::VALID_SETTINGS;
+                       $schema_styles_blocks[ $block ]               = $styles_non_top_level;
+                       $schema_styles_blocks[ $block ]['elements']   = $schema_styles_elements;
+                       $schema_styles_blocks[ $block ]['variations'] = $schema_styles_variations;
</ins><span class="cx" style="display: block; padding: 0 10px">                 }
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px">                $schema['styles']             = static::VALID_STYLES;
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -814,6 +829,15 @@
</span><span class="cx" style="display: block; padding: 0 10px">                                }
</span><span class="cx" style="display: block; padding: 0 10px">                                static::$blocks_metadata[ $block_name ]['elements'][ $el_name ] = implode( ',', $element_selector );
</span><span class="cx" style="display: block; padding: 0 10px">                        }
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                        // If the block has style variations, append their selectors to the block metadata.
+                       if ( ! empty( $block_type->styles ) ) {
+                               $style_selectors = array();
+                               foreach ( $block_type->styles as $style ) {
+                                       // The style variation classname is duplicated in the selector to ensure that it overrides core block styles.
+                                       $style_selectors[ $style['name'] ] = static::append_to_selector( '.is-style-' . $style['name'] . '.is-style-' . $style['name'], static::$blocks_metadata[ $block_name ]['selector'] );
+                               }
+                               static::$blocks_metadata[ $block_name ]['styleVariations'] = $style_selectors;
+                       }
</ins><span class="cx" style="display: block; padding: 0 10px">                 }
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px">                return static::$blocks_metadata;
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -2039,12 +2063,23 @@
</span><span class="cx" style="display: block; padding: 0 10px">                                $feature_selectors = $selectors[ $name ]['features'];
</span><span class="cx" style="display: block; padding: 0 10px">                        }
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                        $variation_selectors = array();
+                       if ( isset( $node['variations'] ) ) {
+                               foreach ( $node['variations'] as $variation => $node ) {
+                                       $variation_selectors[] = array(
+                                               'path'     => array( 'styles', 'blocks', $name, 'variations', $variation ),
+                                               'selector' => $selectors[ $name ]['styleVariations'][ $variation ],
+                                       );
+                               }
+                       }
+
</ins><span class="cx" style="display: block; padding: 0 10px">                         $nodes[] = array(
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                                'name'     => $name,
-                               'path'     => array( 'styles', 'blocks', $name ),
-                               'selector' => $selector,
-                               'duotone'  => $duotone_selector,
-                               'features' => $feature_selectors,
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                         'name'       => $name,
+                               'path'       => array( 'styles', 'blocks', $name ),
+                               'selector'   => $selector,
+                               'duotone'    => $duotone_selector,
+                               'features'   => $feature_selectors,
+                               'variations' => $variation_selectors,
</ins><span class="cx" style="display: block; padding: 0 10px">                         );
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px">                        if ( isset( $theme_json['styles']['blocks'][ $name ]['elements'] ) ) {
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -2124,6 +2159,54 @@
</span><span class="cx" style="display: block; padding: 0 10px">                        }
</span><span class="cx" style="display: block; padding: 0 10px">                }
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                // If there are style variations, generate the declarations for them, including any feature selectors the block may have.
+               $style_variation_declarations = array();
+               if ( ! empty( $block_metadata['variations'] ) ) {
+                       foreach ( $block_metadata['variations'] as $style_variation ) {
+                               $style_variation_node     = _wp_array_get( $this->theme_json, $style_variation['path'], array() );
+                               $style_variation_selector = $style_variation['selector'];
+
+                               // If the block has feature selectors, generate the declarations for them within the current style variation.
+                               if ( ! empty( $block_metadata['features'] ) ) {
+                                       $clean_style_variation_selector = trim( $style_variation_selector );
+                                       foreach ( $block_metadata['features'] as $feature_name => $feature_selector ) {
+                                               if ( empty( $style_variation_node[ $feature_name ] ) ) {
+                                                       continue;
+                                               }
+                                               // Prepend the variation selector to the feature selector.
+                                               $split_feature_selectors    = explode( ',', $feature_selector );
+                                               $feature_selectors          = array_map(
+                                                       static function( $split_feature_selector ) use ( $clean_style_variation_selector ) {
+                                                               return $clean_style_variation_selector . trim( $split_feature_selector );
+                                                       },
+                                                       $split_feature_selectors
+                                               );
+                                               $combined_feature_selectors = implode( ',', $feature_selectors );
+
+                                               // Compute declarations for the feature.
+                                               $new_feature_declarations = static::compute_style_properties( array( $feature_name => $style_variation_node[ $feature_name ] ), $settings, null, $this->theme_json );
+
+                                               /*
+                                                * Merge new declarations with any that already exist for
+                                                * the feature selector. This may occur when multiple block
+                                                * support features use the same custom selector.
+                                                */
+                                               if ( isset( $style_variation_declarations[ $combined_feature_selectors ] ) ) {
+                                                       $style_variation_declarations[ $combined_feature_selectors ] = array_merge( $style_variation_declarations[ $combined_feature_selectors ], $new_feature_declarations );
+                                               } else {
+                                                       $style_variation_declarations[ $combined_feature_selectors ] = $new_feature_declarations;
+                                               }
+                                               /*
+                                                * Remove the feature from the variation's node now the
+                                                * styles will be included under the feature level selector.
+                                                */
+                                               unset( $style_variation_node[ $feature_name ] );
+                                       }
+                               }
+                               // Compute declarations for remaining styles not covered by feature level selectors.
+                               $style_variation_declarations[ $style_variation_selector ] = static::compute_style_properties( $style_variation_node, $settings, null, $this->theme_json );
+                       }
+               }
</ins><span class="cx" style="display: block; padding: 0 10px">                 /*
</span><span class="cx" style="display: block; padding: 0 10px">                 * Get a reference to element name from path.
</span><span class="cx" style="display: block; padding: 0 10px">                 * $block_metadata['path'] = array( 'styles','elements','link' );
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -2214,6 +2297,11 @@
</span><span class="cx" style="display: block; padding: 0 10px">                        $block_rules .= static::to_ruleset( $feature_selector, $individual_feature_declarations );
</span><span class="cx" style="display: block; padding: 0 10px">                }
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                // 6. Generate and append the style variation rulesets.
+               foreach ( $style_variation_declarations as $style_variation_selector => $individual_style_variation_declarations ) {
+                       $block_rules .= static::to_ruleset( $style_variation_selector, $individual_style_variation_declarations );
+               }
+
</ins><span class="cx" style="display: block; padding: 0 10px">                 return $block_rules;
</span><span class="cx" style="display: block; padding: 0 10px">        }
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span></span></pre></div>
<a id="trunktestsphpunitteststhemewpThemeJsonphp"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: trunk/tests/phpunit/tests/theme/wpThemeJson.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/tests/phpunit/tests/theme/wpThemeJson.php   2023-01-31 19:39:51 UTC (rev 55171)
+++ trunk/tests/phpunit/tests/theme/wpThemeJson.php     2023-02-01 13:41:16 UTC (rev 55172)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -3596,6 +3596,306 @@
</span><span class="cx" style="display: block; padding: 0 10px">        }
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px">        /**
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+         * @ticket 57583
+        *
+        * @dataProvider data_sanitize_for_block_with_style_variations
+        *
+        * @param array $theme_json_variations Theme.json variations to test.
+        * @param array $expected_sanitized    Expected results after sanitizing.
+        */
+       public function test_sanitize_for_block_with_style_variations( $theme_json_variations, $expected_sanitized ) {
+               $theme_json = new WP_Theme_JSON(
+                       array(
+                               'version' => 2,
+                               'styles'  => array(
+                                       'blocks' => array(
+                                               'core/quote' => $theme_json_variations,
+                                       ),
+                               ),
+                       )
+               );
+
+               // Validate structure is sanitized.
+               $sanitized_theme_json = $theme_json->get_raw_data();
+               $this->assertIsArray( $sanitized_theme_json, 'Sanitized theme.json is not an array data type' );
+               $this->assertArrayHasKey( 'styles', $sanitized_theme_json, 'Sanitized theme.json does not have an "styles" key' );
+               $this->assertSameSetsWithIndex( $expected_sanitized, $sanitized_theme_json['styles'], 'Sanitized theme.json styles does not match' );
+       }
+
+       /**
+        * Data provider.
+        *
+        * @return array
+        */
+       public function data_sanitize_for_block_with_style_variations() {
+               return array(
+                       '1 variation with 1 invalid property'   => array(
+                               'theme_json_variations' => array(
+                                       'variations' => array(
+                                               'plain' => array(
+                                                       'color' => array(
+                                                               'background' => 'hotpink',
+                                                       ),
+                                               ),
+                                       ),
+                               ),
+                               'expected_sanitized'    => array(
+                                       'blocks' => array(
+                                               'core/quote' => array(
+                                                       'variations' => array(
+                                                               'plain' => array(
+                                                                       'color' => array(
+                                                                               'background' => 'hotpink',
+                                                                       ),
+                                                               ),
+                                                       ),
+                                               ),
+                                       ),
+                               ),
+                       ),
+                       '1 variation with 2 invalid properties' => array(
+                               'theme_json_variations' => array(
+                                       'variations' => array(
+                                               'plain' => array(
+                                                       'color'            => array(
+                                                               'background' => 'hotpink',
+                                                       ),
+                                                       'invalidProperty1' => 'value1',
+                                                       'invalidProperty2' => 'value2',
+                                               ),
+                                       ),
+                               ),
+                               'expected_sanitized'    => array(
+                                       'blocks' => array(
+                                               'core/quote' => array(
+                                                       'variations' => array(
+                                                               'plain' => array(
+                                                                       'color' => array(
+                                                                               'background' => 'hotpink',
+                                                                       ),
+                                                               ),
+                                                       ),
+                                               ),
+                                       ),
+                               ),
+                       ),
+                       '2 variations with 1 invalid property'  => array(
+                               'theme_json_variations' => array(
+                                       'variations' => array(
+                                               'plain' => array(
+                                                       'color'            => array(
+                                                               'background' => 'hotpink',
+                                                       ),
+                                                       'invalidProperty1' => 'value1',
+                                               ),
+                                               'basic' => array(
+                                                       'color' => array(
+                                                               'background' => '#ffffff',
+                                                               'text'       => '#000000',
+                                                       ),
+                                                       'foo'   => 'bar',
+                                               ),
+                                       ),
+                               ),
+                               'expected_sanitized'    => array(
+                                       'blocks' => array(
+                                               'core/quote' => array(
+                                                       'variations' => array(
+                                                               'plain' => array(
+                                                                       'color' => array(
+                                                                               'background' => 'hotpink',
+                                                                       ),
+                                                               ),
+                                                               'basic' => array(
+                                                                       'color' => array(
+                                                                               'background' => '#ffffff',
+                                                                               'text'       => '#000000',
+                                                                       ),
+                                                               ),
+                                                       ),
+                                               ),
+                                       ),
+                               ),
+                       ),
+               );
+       }
+
+       /**
+        * @ticket 57583
+        *
+        * @dataProvider data_sanitize_with_invalid_style_variation
+        *
+        * @param array $theme_json_variations The theme.json variations to test.
+        */
+       public function test_sanitize_with_invalid_style_variation( $theme_json_variations ) {
+               $theme_json = new WP_Theme_JSON(
+                       array(
+                               'version' => 2,
+                               'styles'  => array(
+                                       'blocks' => array(
+                                               'core/quote' => $theme_json_variations,
+                                       ),
+                               ),
+                       )
+               );
+
+               // Validate structure is sanitized.
+               $sanitized_theme_json = $theme_json->get_raw_data();
+               $this->assertIsArray( $sanitized_theme_json, 'Sanitized theme.json is not an array data type' );
+               $this->assertArrayNotHasKey( 'styles', $sanitized_theme_json, 'Sanitized theme.json should not have a "styles" key' );
+
+       }
+
+       /**
+        * Data provider.
+        *
+        * @return array
+        */
+       public function data_sanitize_with_invalid_style_variation() {
+               return array(
+                       'empty string variation' => array(
+                               array(
+                                       'variations' => '',
+                               ),
+                       ),
+                       'boolean variation'      => array(
+                               array(
+                                       'variations' => false,
+                               ),
+                       ),
+               );
+       }
+
+       /**
+        * @ticket 57583
+        *
+        * @dataProvider data_get_styles_for_block_with_style_variations
+        *
+        * @param array  $theme_json_variations Theme.json variations to test.
+        * @param string $metadata_variations   Style variations to test.
+        * @param string $expected              Expected results for styling.
+        */
+       public function test_get_styles_for_block_with_style_variations( $theme_json_variations, $metadata_variations, $expected ) {
+               $theme_json = new WP_Theme_JSON(
+                       array(
+                               'version' => 2,
+                               'styles'  => array(
+                                       'blocks' => array(
+                                               'core/quote' => $theme_json_variations,
+                                       ),
+                               ),
+                       )
+               );
+
+               // Validate styles are generated properly.
+               $metadata      = array(
+                       'path'       => array( 'styles', 'blocks', 'core/quote' ),
+                       'selector'   => '.wp-block-quote',
+                       'variations' => $metadata_variations,
+               );
+               $actual_styles = $theme_json->get_styles_for_block( $metadata );
+               $this->assertSame( $expected, $actual_styles );
+       }
+
+       /**
+        * Data provider.
+        *
+        * @return array
+        */
+       public function data_get_styles_for_block_with_style_variations() {
+               $plain = array(
+                       'metadata' => array(
+                               'path'     => array( 'styles', 'blocks', 'core/quote', 'variations', 'plain' ),
+                               'selector' => '.is-style-plain.is-style-plain.wp-block-quote',
+                       ),
+                       'styles'   => '.is-style-plain.is-style-plain.wp-block-quote{background-color: hotpink;}',
+               );
+               $basic = array(
+                       'metadata' => array(
+                               'path'     => array( 'styles', 'blocks', 'core/quote', 'variations', 'basic' ),
+                               'selector' => '.is-style-basic.is-style-basic.wp-block-quote',
+                       ),
+                       'styles'   => '.is-style-basic.is-style-basic.wp-block-quote{background-color: #ffffff;color: #000000;}',
+               );
+
+               return array(
+                       '1 variation with 1 invalid property'   => array(
+                               'theme_json_variations' => array(
+                                       'variations' => array(
+                                               'plain' => array(
+                                                       'color' => array(
+                                                               'background' => 'hotpink',
+                                                       ),
+                                               ),
+                                       ),
+                               ),
+                               'metadata_variation'    => array( $plain['metadata'] ),
+                               'expected'              => $plain['styles'],
+                       ),
+                       '1 variation with 2 invalid properties' => array(
+                               'theme_json_variations' => array(
+                                       'variations' => array(
+                                               'plain' => array(
+                                                       'color'            => array(
+                                                               'background' => 'hotpink',
+                                                       ),
+                                                       'invalidProperty1' => 'value1',
+                                                       'invalidProperty2' => 'value2',
+                                               ),
+                                       ),
+                               ),
+                               'metadata_variation'    => array( $plain['metadata'] ),
+                               'expected'              => $plain['styles'],
+                       ),
+                       '2 variations with 1 invalid property'  => array(
+                               'theme_json_variations' => array(
+                                       'variations' => array(
+                                               'plain' => array(
+                                                       'color'            => array(
+                                                               'background' => 'hotpink',
+                                                       ),
+                                                       'invalidProperty1' => 'value1',
+                                               ),
+                                               'basic' => array(
+                                                       'color' => array(
+                                                               'background' => '#ffffff',
+                                                               'text'       => '#000000',
+                                                       ),
+                                                       'foo'   => 'bar',
+                                               ),
+                                       ),
+                               ),
+                               'metadata_variation'    => array( $plain['metadata'], $basic['metadata'] ),
+                               'expected_styles'       => $plain['styles'] . $basic['styles'],
+                       ),
+                       '2 variations with multiple invalid properties' => array(
+                               'theme_json_variations' => array(
+                                       'variations' => array(
+                                               'plain' => array(
+                                                       'color'            => array(
+                                                               'background' => 'hotpink',
+                                                       ),
+                                                       'invalidProperty1' => 'value1',
+                                                       'invalidProperty2' => 'value2',
+                                               ),
+                                               'basic' => array(
+                                                       'foo'   => 'foo',
+                                                       'color' => array(
+                                                               'background' => '#ffffff',
+                                                               'text'       => '#000000',
+                                                       ),
+                                                       'bar'   => 'bar',
+                                                       'baz'   => 'baz',
+                                               ),
+                                       ),
+                               ),
+                               'metadata_variation'    => array( $plain['metadata'], $basic['metadata'] ),
+                               'expected_styles'       => $plain['styles'] . $basic['styles'],
+                       ),
+               );
+       }
+
+       /**
</ins><span class="cx" style="display: block; padding: 0 10px">          * @ticket 56611
</span><span class="cx" style="display: block; padding: 0 10px">         */
</span><span class="cx" style="display: block; padding: 0 10px">        public function test_get_styles_with_appearance_tools() {
</span></span></pre>
</div>
</div>

</body>
</html>