Skip to content

Commit a811232

Browse files
juanmaguitarclaude
andcommitted
Use NOWDOC syntax in RenderCardBlockTest
Switches $expected in test_card_block_renders_with_background_color from a regular single-quoted string to a NOWDOC (<<<'HTML') with an indented closing marker. The result is easier to read and aligns naturally with the surrounding method indentation. Indented closing markers require PHP 7.3+, which is the minimum version for WordPress 7.0. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
1 parent badabdf commit a811232

1 file changed

Lines changed: 8 additions & 2 deletions

File tree

‎tests/RenderCardBlockTest.php‎

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,10 @@ class RenderCardBlockTest extends WP_UnitTestCase {
2323
* actual output. Since the render callback concatenates $content directly
2424
* with no surrounding whitespace, the expected string must do the same:
2525
* `...><p>...</p></div>` with no gaps.
26+
*
27+
* NOWDOC syntax (<<<'HTML') keeps the expected markup readable without
28+
* variable interpolation. Indented closing markers (PHP 7.3+) let the
29+
* heredoc align naturally with the surrounding code.
2630
*/
2731
public function test_card_block_renders_with_background_color(): void {
2832
$attributes = array(
@@ -38,10 +42,12 @@ public function test_card_block_renders_with_background_color(): void {
3842
// Attributes may be on separate lines for readability — that's fine.
3943
// But there must be no whitespace between > and <p>, since the actual
4044
// output has none (whitespace-only text nodes are compared as-is).
41-
$expected = '<div
45+
$expected = <<<'HTML'
46+
<div
4247
class="is-style-outlined my-custom-class wp-block-my-plugin-card"
4348
style="background-color: #f5f5f5;"
44-
><p class="wp-block-paragraph">Hello</p></div>';
49+
><p class="wp-block-paragraph">Hello</p></div>
50+
HTML;
4551

4652
$this->assertEqualHTML( $expected, $output );
4753
}

0 commit comments

Comments
 (0)