diff --git a/tests/phpunit/tests/blocks/serialization.php b/tests/phpunit/tests/blocks/serialization.php new file mode 100644 index 0000000000..48ee778b82 --- /dev/null +++ b/tests/phpunit/tests/blocks/serialization.php @@ -0,0 +1,60 @@ +assertEquals( $expected, $actual ); + } + + function data_serialize_identity_from_parsed() { + return array( + // Void block. + array( '' ), + + // Freeform content ($block_name = null). + array( 'Example.' ), + + // Block with content. + array( 'Example.' ), + + // Block with attributes. + array( '' ), + + // Block with inner blocks. + array( "Example.\n\nExample.\n\n" ), + + // Block with attribute values that may conflict with HTML comment. + array( '' ), + ); + } + + function test_serialized_block_name() { + $this->assertEquals( null, strip_core_block_namespace( null ) ); + $this->assertEquals( 'example', strip_core_block_namespace( 'example' ) ); + $this->assertEquals( 'example', strip_core_block_namespace( 'core/example' ) ); + $this->assertEquals( 'plugin/example', strip_core_block_namespace( 'plugin/example' ) ); + } + +}