Skip to content

Commit b705a0b

Browse files
committed
1 parent 50fb408 commit b705a0b

1 file changed

Lines changed: 37 additions & 0 deletions

File tree

‎tests/phpunit/tests/blocks/serialize.php‎

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,37 @@
1010
* @group blocks
1111
*/
1212
class Tests_Blocks_Serialize extends WP_UnitTestCase {
13+
/**
14+
* Set up.
15+
*
16+
* @ticket 63325.
17+
*/
18+
public static function wpSetUpBeforeClass() {
19+
register_block_type(
20+
'core/attributes',
21+
array(
22+
'attributes' => array(
23+
'array' => array(
24+
'type' => 'array',
25+
),
26+
'object' => array(
27+
'type' => 'object',
28+
),
29+
),
30+
)
31+
);
32+
}
33+
34+
/**
35+
* Tear down.
36+
*
37+
* @ticket 63325.
38+
*/
39+
public static function wpTearDownAfterClass() {
40+
$registry = WP_Block_Type_Registry::get_instance();
41+
42+
$registry->unregister( 'core/attributes' );
43+
}
1344

1445
/**
1546
* @dataProvider data_serialize_identity_from_parsed
@@ -46,6 +77,12 @@ public function data_serialize_identity_from_parsed() {
4677

4778
// Block with attribute values that should not be escaped.
4879
array( '<!-- wp:attributes {"key":"€1.00 / 3 for €2.00"} /-->' ),
80+
81+
// Block with empty array attribute value.
82+
array( '<!-- wp:attributes {"array":[]} /-->' ),
83+
84+
// Block with empty object attribute value.
85+
array( '<!-- wp:attributes {"object":{}} /-->' ),
4986
);
5087
}
5188

0 commit comments

Comments
 (0)