Changeset 56997 for branches/6.4
- Timestamp:
- 10/24/2023 11:06:59 AM (2 years ago)
- Location:
- branches/6.4
- Files:
-
- 3 edited
-
. (modified) (1 prop)
-
src/wp-includes/class-wp-duotone.php (modified) (1 diff)
-
tests/phpunit/tests/block-supports/duotone.php (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
branches/6.4
- Property svn:mergeinfo changed
/trunk merged: 56991,56996
- Property svn:mergeinfo changed
-
branches/6.4/src/wp-includes/class-wp-duotone.php
r56709 r56997 1075 1075 */ 1076 1076 public static function render_duotone_support( $block_content, $block, $wp_block ) { 1077 if ( empty( $block_content ) ||! $block['blockName'] ) {1077 if ( ! $block['blockName'] ) { 1078 1078 return $block_content; 1079 1079 } -
branches/6.4/tests/phpunit/tests/block-supports/duotone.php
r56226 r56997 102 102 103 103 /** 104 * Tests whether the CSS declarations are generated even if the block content is 105 * empty. This is needed to make the CSS output stable across paginations for 106 * features like the enhanced pagination of the Query block. 107 * 108 * @ticket 59694 109 * 110 * @covers ::render_duotone_support 111 */ 112 public function test_css_declarations_are_generated_even_with_empty_block_content() { 113 $block = array( 114 'blockName' => 'core/image', 115 'attrs' => array( 'style' => array( 'color' => array( 'duotone' => 'var:preset|duotone|blue-orange' ) ) ), 116 ); 117 $wp_block = new WP_Block( $block ); 118 119 /* 120 * Handling to access the static WP_Duotone::$block_css_declarations property. 121 * 122 * Why is an instance needed? 123 * WP_Duotone is a static class by design, meaning it only contains static properties and methods. 124 * In production, it should not be instantiated. However, as of PHP 8.3, ReflectionProperty::setValue() 125 * needs an object. 126 */ 127 $wp_duotone = new WP_Duotone(); 128 $block_css_declarations_property = new ReflectionProperty( 'WP_Duotone', 'block_css_declarations' ); 129 $block_css_declarations_property->setAccessible( true ); 130 $previous_value = $block_css_declarations_property->getValue(); 131 $block_css_declarations_property->setValue( $wp_duotone, array() ); 132 133 WP_Duotone::render_duotone_support( '', $block, $wp_block ); 134 $actual = $block_css_declarations_property->getValue(); 135 136 // Reset the property. 137 $block_css_declarations_property->setValue( $wp_duotone, $previous_value ); 138 $block_css_declarations_property->setAccessible( false ); 139 140 $this->assertNotEmpty( $actual ); 141 } 142 143 /** 104 144 * @dataProvider data_is_preset 105 145 */
Note: See TracChangeset
for help on using the changeset viewer.