Make WordPress Core


Ignore:
Timestamp:
06/01/2020 12:25:34 PM (4 years ago)
Author:
gziolo
Message:

Add fields to WP_Block_Type

As part of #47620 and the RFC for block registeration. Server registered blocks are missing some fields. These changeset includes them.

Props spacedmonkey, aduth.

Fixes #48529.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/tests/phpunit/tests/blocks/block-type.php

    r46896 r47875  
    351351
    352352    /**
     353     * @ticket 48529
     354     */
     355    public function test_register_block() {
     356        $block_type = new WP_Block_Type( 'core/fake', array(
     357            'title'       => 'Test title',
     358            'category'    => 'Test category',
     359            'parent'      => array( 'core/third-party' ),
     360            'icon'        => 'icon.png',
     361            'description' => 'test description',
     362            'keywords'    => array( 'test keyword' ),
     363            'textdomain'  => 'test_domain',
     364            'supports'    => array( 'alignment' => true ),
     365        ) );
     366
     367        $this->assertSame( 'Test title', $block_type->title );
     368        $this->assertSame( 'Test category', $block_type->category );
     369        $this->assertEqualSets( array( 'core/third-party' ), $block_type->parent );
     370        $this->assertSame( 'icon.png', $block_type->icon );
     371        $this->assertSame( 'test description', $block_type->description );
     372        $this->assertEqualSets( array( 'test keyword' ), $block_type->keywords );
     373        $this->assertSame( 'test_domain', $block_type->textdomain );
     374        $this->assertEqualSets( array( 'alignment' => true ), $block_type->supports );
     375    }
     376
     377    /**
    353378     * Testing the block version.
    354379     *
Note: See TracChangeset for help on using the changeset viewer.