You appear to be a bot. Output may be restricted
Description
Util check block type object against.
Usage
REST_Block_Type_Controller_Test::check_block_type_object( $block_type, $data, $links );
Parameters
- $block_type
- ( WP_Block_Type ) required – Sample block type.
- $data
- ( array ) required – Data to compare against.
- $links
- ( array ) required – Links to compare again.
Returns
void
Source
File name: wordpress-develop-tests/phpunit/tests/rest-api/rest-block-type-controller.php
Lines:
1 to 41 of 41
protected function check_block_type_object( $block_type, $data, $links ) { // Test data. $this->assertSame( $data['attributes'], $block_type->get_attributes() ); $this->assertSame( $data['is_dynamic'], $block_type->is_dynamic() ); $extra_fields = array( 'api_version', 'name', 'category', 'editor_script', 'script', 'view_script', 'editor_style', 'style', 'title', 'icon', 'description', 'keywords', 'parent', 'provides_context', 'uses_context', 'supports', 'styles', 'textdomain', 'example', ); foreach ( $extra_fields as $extra_field ) { if ( isset( $block_type->$extra_field ) ) { $this->assertSame( $data[ $extra_field ], $block_type->$extra_field ); } } // Test links. $this->assertSame( rest_url( 'wp/v2/block-types' ), $links['collection'][0]['href'] ); $this->assertSame( rest_url( 'wp/v2/block-types/' . $block_type->name ), $links['self'][0]['href'] ); if ( $block_type->is_dynamic() ) { $this->assertArrayHasKey( 'https://api.w.org/render-block', $links ); } }