Editor: Fix code style for constructor arguments added in [47875].

Also revert unintended changes to `WP_Block_Type::__construct()` DocBlock.

See #48529.

git-svn-id: https://develop.svn.wordpress.org/trunk@47876 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Dominik Schilling 2020-06-01 16:25:18 +00:00
parent 822ca9ebc7
commit 028299ac79
3 changed files with 29 additions and 24 deletions

View File

@ -137,14 +137,13 @@ class WP_Block_Type {
*
* Will populate object properties from the provided arguments.
*
* @since 5.0.0
*
* @see register_block_type()
*
* @param string $block_type Block type name including namespace.
* @param array|string $args Optional. Array or string of arguments for registering a block type.
* Default empty array.
*
* @since 5.0.0
*
* @see register_block_type()
*
*/
public function __construct( $block_type, $args = array() ) {
$this->name = $block_type;

View File

@ -837,15 +837,18 @@ class Tests_Admin_Includes_Post extends WP_UnitTestCase {
unregister_block_type( $name );
$this->assertArrayHasKey( $name, $blocks );
$this->assertEquals( array(
'title' => '',
'description' => '',
'category' => 'common',
'icon' => 'text',
'keywords' => array(),
'supports' => array(),
'styles' => array(),
), $blocks[ $name ] );
$this->assertEquals(
array(
'title' => '',
'description' => '',
'category' => 'common',
'icon' => 'text',
'keywords' => array(),
'supports' => array(),
'styles' => array(),
),
$blocks[ $name ]
);
}
/**

View File

@ -353,16 +353,19 @@ class WP_Test_Block_Type extends WP_UnitTestCase {
* @ticket 48529
*/
public function test_register_block() {
$block_type = new WP_Block_Type( 'core/fake', array(
'title' => 'Test title',
'category' => 'Test category',
'parent' => array( 'core/third-party' ),
'icon' => 'icon.png',
'description' => 'test description',
'keywords' => array( 'test keyword' ),
'textdomain' => 'test_domain',
'supports' => array( 'alignment' => true ),
) );
$block_type = new WP_Block_Type(
'core/fake',
array(
'title' => 'Test title',
'category' => 'Test category',
'parent' => array( 'core/third-party' ),
'icon' => 'icon.png',
'description' => 'test description',
'keywords' => array( 'test keyword' ),
'textdomain' => 'test_domain',
'supports' => array( 'alignment' => true ),
)
);
$this->assertSame( 'Test title', $block_type->title );
$this->assertSame( 'Test category', $block_type->category );