Changeset 44127 for trunk/tests/phpunit/tests/blocks/block-type.php
- Timestamp:
- 12/14/2018 12:54:51 AM (6 years ago)
- Location:
- trunk
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk
- Property svn:mergeinfo changed
/branches/5.0 merged: 43770
- Property svn:mergeinfo changed
-
trunk/tests/phpunit/tests/blocks/block-type.php
r43742 r44127 311 311 return json_encode( $attributes ); 312 312 } 313 314 /** 315 * Testing the block version. 316 * 317 * @ticket 43887 318 * 319 * @dataProvider data_block_version 320 * 321 * @param string|null $content Content. 322 * @param int $expected Expected block version. 323 */ 324 public function test_block_version( $content, $expected ) { 325 $this->assertSame( $expected, block_version( $content ) ); 326 } 327 328 /** 329 * Test cases for test_block_version(). 330 * 331 * @since 5.0.0 332 * 333 * @return array { 334 * @type array { 335 * @type string|null Content. 336 * @type int Expected block version. 337 * } 338 * } 339 */ 340 public function data_block_version() { 341 return array( 342 // Null. 343 array( null, 0 ), 344 // Empty post content. 345 array( '', 0 ), 346 // Post content without blocks. 347 array( '<hr class="wp-block-separator" />', 0 ), 348 // Post content with a block. 349 array( '<!-- wp:core/separator -->', 1 ), 350 // Post content with a fake block. 351 array( '<!-- wp:core/fake --><!-- /wp:core/fake -->', 1 ), 352 // Post content with an invalid block. 353 array( '<!- - wp:core/separator -->', 0 ), 354 ); 355 } 313 356 }
Note: See TracChangeset
for help on using the changeset viewer.