diff --git a/phpunit/class-block-library-comment-template-test.php b/phpunit/class-block-library-comment-template-test.php index 3db3e66814c74c..8099ed1f08cf61 100644 --- a/phpunit/class-block-library-comment-template-test.php +++ b/phpunit/class-block-library-comment-template-test.php @@ -144,16 +144,17 @@ function test_rendering_comment_template() { } /** - * Test rendering 3 nested comments: + * Test rendering nested comments: * * └─ comment 1 *   └─ comment 2 - *    └─ comment 3 + *    └─ comment 4 + *   └─ comment 3 */ function test_rendering_comment_template_nested() { $first_level_ids = self::factory()->comment->create_post_comments( self::$custom_post->ID, - 1, + 2, array( 'comment_parent' => self::$comment_ids[0], 'comment_author' => 'Test', @@ -186,9 +187,63 @@ function test_rendering_comment_template_nested() { ) ); + $top_level_ids = self::$comment_ids; + $expected = str_replace( + array( "\n", "\t" ), + '', + << +
  • + +
    + Hello world +
    +
      +
    1. + +
      + Hello world +
      +
        +
      1. + +
        + Hello world +
        +
      2. +
      +
    2. +
    3. + +
      + Hello world +
      +
    4. +
    +
  • + +END + ); + $this->assertEquals( gutenberg_render_block_core_comment_template( null, null, $block ), - '
    1. Hello world
      1. Hello world
        1. Hello world
    ' + $expected ); } /**