From 028299ac79297afbe9b31c618d24100e292441da Mon Sep 17 00:00:00 2001 From: Dominik Schilling Date: Mon, 1 Jun 2020 16:25:18 +0000 Subject: [PATCH] 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 --- src/wp-includes/class-wp-block-type.php | 9 ++++----- tests/phpunit/tests/admin/includesPost.php | 21 +++++++++++--------- tests/phpunit/tests/blocks/block-type.php | 23 ++++++++++++---------- 3 files changed, 29 insertions(+), 24 deletions(-) diff --git a/src/wp-includes/class-wp-block-type.php b/src/wp-includes/class-wp-block-type.php index 4d7ba9bd26..bd1109fb8f 100644 --- a/src/wp-includes/class-wp-block-type.php +++ b/src/wp-includes/class-wp-block-type.php @@ -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; diff --git a/tests/phpunit/tests/admin/includesPost.php b/tests/phpunit/tests/admin/includesPost.php index d15497e3ec..020626ccb8 100644 --- a/tests/phpunit/tests/admin/includesPost.php +++ b/tests/phpunit/tests/admin/includesPost.php @@ -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 ] + ); } /** diff --git a/tests/phpunit/tests/blocks/block-type.php b/tests/phpunit/tests/blocks/block-type.php index 4605d10733..969c0ab7db 100644 --- a/tests/phpunit/tests/blocks/block-type.php +++ b/tests/phpunit/tests/blocks/block-type.php @@ -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 );