<!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>[54670] trunk: Blocks: Allow arrays for deprecated asset types in block registration.</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/54670">54670</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/54670","name":"Review Commit"}}</script></dd>
<dt style="float: left; width: 6em; font-weight: bold">Author</dt> <dd>Bernhard Reiter</dd>
<dt style="float: left; width: 6em; font-weight: bold">Date</dt> <dd>2022-10-24 14:14:25 +0000 (Mon, 24 Oct 2022)</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'>Blocks: Allow arrays for deprecated asset types in block registration.
In `register_block_type`, continue to allow passing arrays as the `editor_script`, `script`, `view_script`, `editor_style`, and `style` arguments. Note that those fields were soft-deprecated in favor of their `_handles` counterparts in <a href="https://core.trac.wordpress.org/changeset/54155">[54155]</a>, which would allow specifying multiple items. At the same time, the deprecated fields were limited to `string` or `null`.
However, this broke existing code that passed an array as one of those arguments. For backwards compatibility, this change thus restores the previous behavior. It is implemented in `WP_Block_Type` as a pair of `__get()` and `__set()` methods that wrap around the corresponding `_handles` members, which are arrays of strings.
It also affects the REST API endpoint for block types. The latter's schema has never allowed for anything other than `string` or `null` for any of those fields. For this reason, it now returns the first element of the array stored in the corresponding `_handles` member in `WP_Block_Type`.
Follow-up <a href="https://core.trac.wordpress.org/changeset/54155">[54155]</a>.
Props nendeb55, costdev, gziolo, spacedmonkey, mukesh27, sergeybiryukov, audrasjb.
Fixes <a href="https://core.trac.wordpress.org/ticket/56707">#56707</a>.</pre>
<h3>Modified Paths</h3>
<ul>
<li><a href="#trunksrcwpincludesclasswpblocktypephp">trunk/src/wp-includes/class-wp-block-type.php</a></li>
<li><a href="#trunksrcwpincludesrestapiendpointsclasswprestblocktypescontrollerphp">trunk/src/wp-includes/rest-api/endpoints/class-wp-rest-block-types-controller.php</a></li>
<li><a href="#trunktestsphpunittestsblocksregisterphp">trunk/tests/phpunit/tests/blocks/register.php</a></li>
<li><a href="#trunktestsphpunittestsrestapirestblocktypecontrollerphp">trunk/tests/phpunit/tests/rest-api/rest-block-type-controller.php</a></li>
</ul>
</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunksrcwpincludesclasswpblocktypephp"></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-block-type.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/src/wp-includes/class-wp-block-type.php 2022-10-24 10:01:01 UTC (rev 54669)
+++ trunk/src/wp-includes/class-wp-block-type.php 2022-10-24 14:14:25 UTC (rev 54670)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -295,8 +295,8 @@
</span><span class="cx" style="display: block; padding: 0 10px"> *
</span><span class="cx" style="display: block; padding: 0 10px"> * @param string $name Deprecated property name.
</span><span class="cx" style="display: block; padding: 0 10px"> *
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * @return string|null|void The value read from the new property if the first item in the array provided,
- * null when value not found, or void when unknown property name provided.
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * @return string|string[]|null|void The value read from the new property if the first item in the array provided,
+ * null when value not found, or void when unknown property name provided.
</ins><span class="cx" style="display: block; padding: 0 10px"> */
</span><span class="cx" style="display: block; padding: 0 10px"> public function __get( $name ) {
</span><span class="cx" style="display: block; padding: 0 10px"> if ( ! in_array( $name, $this->deprecated_properties ) ) {
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -304,6 +304,14 @@
</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"> $new_name = $name . '_handles';
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+
+ if ( ! property_exists( $this, $new_name ) || ! is_array( $this->{$new_name} ) ) {
+ return null;
+ }
+
+ if ( count( $this->{$new_name} ) > 1 ) {
+ return $this->{$new_name};
+ }
</ins><span class="cx" style="display: block; padding: 0 10px"> return isset( $this->{$new_name}[0] ) ? $this->{$new_name}[0] : null;
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -343,12 +351,32 @@
</span><span class="cx" style="display: block; padding: 0 10px"> return;
</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">+ $new_name = $name . '_handles';
+
+ if ( is_array( $value ) ) {
+ $filtered = array_filter( $value, 'is_string' );
+
+ if ( count( $filtered ) !== count( $value ) ) {
+ _doing_it_wrong(
+ __METHOD__,
+ sprintf(
+ /* translators: %s: The '$value' argument. */
+ __( 'The %s argument must be a string or a string array.' ),
+ '<code>$value</code>'
+ ),
+ '6.1.0'
+ );
+ }
+
+ $this->{$new_name} = array_values( $filtered );
+ return;
+ }
+
</ins><span class="cx" style="display: block; padding: 0 10px"> if ( ! is_string( $value ) ) {
</span><span class="cx" style="display: block; padding: 0 10px"> return;
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- $new_name = $name . '_handles';
- $this->{$new_name}[0] = $value;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ $this->{$new_name} = array( $value );
</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"> /**
</span></span></pre></div>
<a id="trunksrcwpincludesrestapiendpointsclasswprestblocktypescontrollerphp"></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/rest-api/endpoints/class-wp-rest-block-types-controller.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/src/wp-includes/rest-api/endpoints/class-wp-rest-block-types-controller.php 2022-10-24 10:01:01 UTC (rev 54669)
+++ trunk/src/wp-includes/rest-api/endpoints/class-wp-rest-block-types-controller.php 2022-10-24 14:14:25 UTC (rev 54670)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -295,6 +295,10 @@
</span><span class="cx" style="display: block; padding: 0 10px"> if ( rest_is_field_included( $extra_field, $fields ) ) {
</span><span class="cx" style="display: block; padding: 0 10px"> if ( isset( $block_type->$extra_field ) ) {
</span><span class="cx" style="display: block; padding: 0 10px"> $field = $block_type->$extra_field;
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ if ( in_array( $extra_field, $deprecated_fields, true ) && is_array( $field ) ) {
+ // Since the schema only allows strings or null (but no arrays), we return the first array item.
+ $field = ! empty( $field ) ? array_shift( $field ) : '';
+ }
</ins><span class="cx" style="display: block; padding: 0 10px"> } elseif ( array_key_exists( 'default', $schema['properties'][ $extra_field ] ) ) {
</span><span class="cx" style="display: block; padding: 0 10px"> $field = $schema['properties'][ $extra_field ]['default'];
</span><span class="cx" style="display: block; padding: 0 10px"> } else {
</span></span></pre></div>
<a id="trunktestsphpunittestsblocksregisterphp"></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/blocks/register.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/tests/phpunit/tests/blocks/register.php 2022-10-24 10:01:01 UTC (rev 54669)
+++ trunk/tests/phpunit/tests/blocks/register.php 2022-10-24 14:14:25 UTC (rev 54670)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -553,6 +553,134 @@
</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">+ * Tests that an array value for 'editor_script' is correctly set and retrieved.
+ *
+ * As 'editor_script' is now a deprecated property, this should also set
+ * the value for the 'editor_script_handles' property.
+ *
+ * @ticket 56707
+ *
+ * @covers ::register_block_type
+ * @covers WP_Block_Type::__set
+ * @covers WP_Block_Type::__get
+ *
+ * @dataProvider data_register_block_type_accepts_editor_script_array
+ *
+ * @param array $editor_script The editor script array to register.
+ * @param array $expected The expected registered editor script.
+ */
+ public function test_register_block_type_accepts_editor_script_array( $editor_script, $expected ) {
+ $settings = array( 'editor_script' => $editor_script );
+ register_block_type( 'core/test-static', $settings );
+
+ $registry = WP_Block_Type_Registry::get_instance();
+ $block_type = $registry->get_registered( 'core/test-static' );
+ $this->assertObjectHasAttribute( 'editor_script_handles', $block_type );
+ $actual_script = $block_type->editor_script;
+ $actual_script_handles = $block_type->editor_script_handles;
+
+ $this->assertSame(
+ $expected,
+ $actual_script,
+ 'editor_script was not set to the correct value.'
+ );
+
+ $this->assertSame(
+ (array) $expected,
+ $actual_script_handles,
+ 'editor_script_handles was not set to the correct value.'
+ );
+ }
+
+ /**
+ * Data provider for test_register_block_type_accepts_editor_script_array().
+ *
+ * @return array
+ */
+ public function data_register_block_type_accepts_editor_script_array() {
+ return array(
+ 'an empty array' => array(
+ 'editor_script' => array(),
+ 'expected' => null,
+ ),
+ 'a single item array' => array(
+ 'editor_script' => array( 'hello' ),
+ 'expected' => 'hello',
+ ),
+ 'a multi-item array' => array(
+ 'editor_script' => array( 'hello', 'world' ),
+ 'expected' => array( 'hello', 'world' ),
+ ),
+ );
+ }
+
+ /**
+ * Tests that an array value for 'editor_script' containing invalid values
+ * correctly triggers _doing_it_wrong(), filters the value, and sets the
+ * property to the result.
+ *
+ * As 'editor_script' is now a deprecated property, this should also set
+ * the value for the 'editor_script_handles' property.
+ *
+ * @ticket 56707
+ *
+ * @covers ::register_block_type
+ * @covers WP_Block_Type::__set
+ * @covers WP_Block_Type::__get
+ *
+ * @dataProvider data_register_block_type_throws_doing_it_wrong
+ *
+ * @expectedIncorrectUsage WP_Block_Type::__set
+ *
+ * @param array $editor_script The editor script array to register.
+ * @param array $expected The expected registered editor script.
+ */
+ public function test_register_block_type_throws_doing_it_wrong( $editor_script, $expected ) {
+ $settings = array( 'editor_script' => $editor_script );
+ register_block_type( 'core/test-static', $settings );
+
+ $registry = WP_Block_Type_Registry::get_instance();
+ $block_type = $registry->get_registered( 'core/test-static' );
+ $this->assertObjectHasAttribute( 'editor_script_handles', $block_type );
+ $actual_script = $block_type->editor_script;
+ $actual_script_handles = $block_type->editor_script_handles;
+
+ $this->assertSame(
+ $expected,
+ $actual_script,
+ 'editor_script was not set to the correct value.'
+ );
+
+ $this->assertSame(
+ (array) $expected,
+ $actual_script_handles,
+ 'editor_script_handles was not set to the correct value.'
+ );
+ }
+
+ /**
+ * Data provider for test_register_block_type_throws_doing_it_wrong().
+ *
+ * @return array
+ */
+ public function data_register_block_type_throws_doing_it_wrong() {
+ return array(
+ 'a non-string array' => array(
+ 'editor_script' => array( null, false, true, -1, 0, 1, -1.0, 0.0, 1.0, INF, NAN, new stdClass() ),
+ 'expected' => null,
+ ),
+ 'a partial string array' => array(
+ 'editor_script' => array( null, false, 'script.js', true, 0, 'actions.js', 1, INF ),
+ 'expected' => array( 'script.js', 'actions.js' ),
+ ),
+ 'a partial string array that results in one item with non-zero index' => array(
+ 'editor_script' => array( null, false, 'script.js' ),
+ 'expected' => 'script.js',
+ ),
+ );
+ }
+
+ /**
</ins><span class="cx" style="display: block; padding: 0 10px"> * @ticket 52301
</span><span class="cx" style="display: block; padding: 0 10px"> */
</span><span class="cx" style="display: block; padding: 0 10px"> public function test_block_registers_with_metadata_i18n_support() {
</span></span></pre></div>
<a id="trunktestsphpunittestsrestapirestblocktypecontrollerphp"></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/rest-api/rest-block-type-controller.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/tests/phpunit/tests/rest-api/rest-block-type-controller.php 2022-10-24 10:01:01 UTC (rev 54669)
+++ trunk/tests/phpunit/tests/rest-api/rest-block-type-controller.php 2022-10-24 14:14:25 UTC (rev 54670)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -338,6 +338,148 @@
</span><span class="cx" style="display: block; padding: 0 10px"> $this->assertNull( $data['style'] );
</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 56733
+ */
+ public function test_get_item_deprecated() {
+ $block_type = 'fake/deprecated';
+ $settings = array(
+ 'editor_script' => 'hello_world',
+ 'script' => 'gutenberg',
+ 'view_script' => 'foo_bar',
+ 'editor_style' => 'guten_tag',
+ 'style' => 'out_of_style',
+ );
+ register_block_type( $block_type, $settings );
+ wp_set_current_user( self::$admin_id );
+ $request = new WP_REST_Request( 'GET', '/wp/v2/block-types/' . $block_type );
+ $response = rest_get_server()->dispatch( $request );
+ $data = $response->get_data();
+ $this->assertSameSets(
+ array( 'hello_world' ),
+ $data['editor_script_handles'],
+ "Endpoint doesn't return correct array for editor_script_handles."
+ );
+ $this->assertSameSets(
+ array( 'gutenberg' ),
+ $data['script_handles'],
+ "Endpoint doesn't return correct array for script_handles."
+ );
+ $this->assertSameSets(
+ array( 'foo_bar' ),
+ $data['view_script_handles'],
+ "Endpoint doesn't return correct array for view_script_handles."
+ );
+ $this->assertSameSets(
+ array( 'guten_tag' ),
+ $data['editor_style_handles'],
+ "Endpoint doesn't return correct array for editor_style_handles."
+ );
+ $this->assertSameSets(
+ array( 'out_of_style' ),
+ $data['style_handles'],
+ "Endpoint doesn't return correct array for style_handles."
+ );
+ // Deprecated properties.
+ $this->assertSame(
+ 'hello_world',
+ $data['editor_script'],
+ "Endpoint doesn't return correct string for editor_script."
+ );
+ $this->assertSame(
+ 'gutenberg',
+ $data['script'],
+ "Endpoint doesn't return correct string for script."
+ );
+ $this->assertSame(
+ 'foo_bar',
+ $data['view_script'],
+ "Endpoint doesn't return correct string for view_script."
+ );
+ $this->assertSame(
+ 'guten_tag',
+ $data['editor_style'],
+ "Endpoint doesn't return correct string for editor_style."
+ );
+ $this->assertSame(
+ 'out_of_style',
+ $data['style'],
+ "Endpoint doesn't return correct string for style."
+ );
+ }
+
+ /**
+ * @ticket 56733
+ */
+ public function test_get_item_deprecated_with_arrays() {
+ $block_type = 'fake/deprecated-with-arrays';
+ $settings = array(
+ 'editor_script' => array( 'hello', 'world' ),
+ 'script' => array( 'gutenberg' ),
+ 'view_script' => array( 'foo', 'bar' ),
+ 'editor_style' => array( 'guten', 'tag' ),
+ 'style' => array( 'out', 'of', 'style' ),
+ );
+ register_block_type( $block_type, $settings );
+ wp_set_current_user( self::$admin_id );
+ $request = new WP_REST_Request( 'GET', '/wp/v2/block-types/' . $block_type );
+ $response = rest_get_server()->dispatch( $request );
+ $data = $response->get_data();
+ $this->assertSameSets(
+ $settings['editor_script'],
+ $data['editor_script_handles'],
+ "Endpoint doesn't return correct array for editor_script_handles."
+ );
+ $this->assertSameSets(
+ $settings['script'],
+ $data['script_handles'],
+ "Endpoint doesn't return correct array for script_handles."
+ );
+ $this->assertSameSets(
+ $settings['view_script'],
+ $data['view_script_handles'],
+ "Endpoint doesn't return correct array for view_script_handles."
+ );
+ $this->assertSameSets(
+ $settings['editor_style'],
+ $data['editor_style_handles'],
+ "Endpoint doesn't return correct array for editor_style_handles."
+ );
+ $this->assertSameSets(
+ $settings['style'],
+ $data['style_handles'],
+ "Endpoint doesn't return correct array for style_handles."
+ );
+ // Deprecated properties.
+ // Since the schema only allows strings or null (but no arrays), we return the first array item.
+ // Deprecated properties.
+ $this->assertSame(
+ 'hello',
+ $data['editor_script'],
+ "Endpoint doesn't return first array element for editor_script."
+ );
+ $this->assertSame(
+ 'gutenberg',
+ $data['script'],
+ "Endpoint doesn't return first array element for script."
+ );
+ $this->assertSame(
+ 'foo',
+ $data['view_script'],
+ "Endpoint doesn't return first array element for view_script."
+ );
+ $this->assertSame(
+ 'guten',
+ $data['editor_style'],
+ "Endpoint doesn't return first array element for editor_style."
+ );
+ $this->assertSame(
+ 'out',
+ $data['style'],
+ "Endpoint doesn't return first array element for style."
+ );
+ }
+
</ins><span class="cx" style="display: block; padding: 0 10px"> public function test_get_variation() {
</span><span class="cx" style="display: block; padding: 0 10px"> $block_type = 'fake/variations';
</span><span class="cx" style="display: block; padding: 0 10px"> $settings = array(
</span></span></pre>
</div>
</div>
</body>
</html>