Changeset 50955 for trunk/tests/phpunit/tests/blocks/block.php
- Timestamp:
- 05/24/2021 06:26:00 AM (3 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/tests/phpunit/tests/blocks/block.php
r50945 r50955 568 568 ); 569 569 } 570 571 /** 572 * @ticket 52991 573 */ 574 public function test_block_has_support() { 575 $this->registry->register( 576 'core/example', 577 array( 578 'supports' => array( 579 'align' => array( 'wide', 'full' ), 580 'fontSize' => true, 581 'color' => array( 582 'link' => true, 583 'gradient' => false, 584 ), 585 ), 586 ) 587 ); 588 $block_type = $this->registry->get_registered( 'core/example' ); 589 $align_support = block_has_support( $block_type, array( 'align' ) ); 590 $this->assertTrue( $align_support ); 591 $gradient_support = block_has_support( $block_type, array( 'color', 'gradient' ) ); 592 $this->assertFalse( $gradient_support ); 593 $link_support = block_has_support( $block_type, array( 'color', 'link' ), false ); 594 $this->assertTrue( $link_support ); 595 $text_support = block_has_support( $block_type, array( 'color', 'text' ) ); 596 $this->assertFalse( $text_support ); 597 $font_nested = block_has_support( $block_type, array( 'fontSize', 'nested' ) ); 598 $this->assertFalse( $font_nested ); 599 } 600 601 /** 602 * @ticket 52991 603 */ 604 public function test_block_has_support_no_supports() { 605 $this->registry->register( 'core/example', array() ); 606 $block_type = $this->registry->get_registered( 'core/example' ); 607 $has_support = block_has_support( $block_type, array( 'color' ) ); 608 $this->assertFalse( $has_support ); 609 } 610 611 /** 612 * @ticket 52991 613 */ 614 public function test_block_has_support_provided_defaults() { 615 $this->registry->register( 616 'core/example', 617 array( 618 'supports' => array( 619 'color' => array( 620 'gradient' => false, 621 ), 622 ), 623 ) 624 ); 625 $block_type = $this->registry->get_registered( 'core/example' ); 626 $align_support = block_has_support( $block_type, array( 'align' ), true ); 627 $this->assertTrue( $align_support ); 628 $gradient_support = block_has_support( $block_type, array( 'color', 'gradient' ), true ); 629 $this->assertFalse( $gradient_support ); 630 } 570 631 }
Note: See TracChangeset
for help on using the changeset viewer.