Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 37 additions & 0 deletions tests/phpunit/tests/blocks/serialize.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,37 @@
* @group blocks
*/
class Tests_Blocks_Serialize extends WP_UnitTestCase {
/**
* Set up.
*
* @ticket 63325.
*/
public static function wpSetUpBeforeClass() {
register_block_type(
'core/attributes',
array(
'attributes' => array(
'array' => array(
'type' => 'array',
),
'object' => array(
'type' => 'object',
),
),
)
);
}

/**
* Tear down.
*
* @ticket 63325.
*/
public static function wpTearDownAfterClass() {
$registry = WP_Block_Type_Registry::get_instance();

$registry->unregister( 'core/attributes' );
}

/**
* @dataProvider data_serialize_identity_from_parsed
Expand Down Expand Up @@ -46,6 +77,12 @@ public function data_serialize_identity_from_parsed() {

// Block with attribute values that should not be escaped.
array( '<!-- wp:attributes {"key":"€1.00 / 3 for €2.00"} /-->' ),

// Block with empty array attribute value.
array( '<!-- wp:attributes {"array":[]} /-->' ),

// Block with empty object attribute value.
array( '<!-- wp:attributes {"object":{}} /-->' ),
);
}

Expand Down
Loading