Skip to content

Commit

Permalink
HTML API: Test code improvements in virtual node breadcrumb tests.
Browse files Browse the repository at this point in the history
Follow-up after feedback to newly-introduced tests,
mostly to enhance the message when the tests fail.

Developed in WordPress#7030
Discussed in https://core.trac.wordpress.org/ticket/61646

Follow-up to [58592].

Props dmsnell, jonsurrell.
See #61646.


git-svn-id: https://develop.svn.wordpress.org/trunk@58741 602fd350-edb4-49c9-b593-d223f7449a82
  • Loading branch information
dmsnell committed Jul 17, 2024
1 parent 2f1cf1f commit 8f11947
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions tests/phpunit/tests/html-api/wpHtmlProcessorBreadcrumbs.php
Original file line number Diff line number Diff line change
Expand Up @@ -587,14 +587,14 @@ public function test_breadcrumbs_on_virtual_nodes( string $html, int $token_posi
$processor->next_token();
}

$this->assertSame( $expected_tag_name, $processor->get_tag(), "Found incorrect tag name {$processor->get_tag()}." );
$this->assertSame( $expected_tag_name, $processor->get_tag(), "Found incorrect tag name {$processor->get_token_name()}." );
if ( 'open' === $expect_open_close ) {
$this->assertFalse( $processor->is_tag_closer(), "Found closer when opener expected at {$processor->get_tag()}." );
$this->assertFalse( $processor->is_tag_closer(), "Found closer when opener expected at {$processor->get_token_name()}." );
} else {
$this->assertTrue( $processor->is_tag_closer(), "Found opener when closer expected at {$processor->get_tag()}." );
$this->assertTrue( $processor->is_tag_closer(), "Found opener when closer expected at {$processor->get_token_name()}." );
}

$this->assertEquals( $expected_breadcrumbs, $processor->get_breadcrumbs(), "Found incorrect breadcrumbs in {$html}." );
$this->assertSame( $expected_breadcrumbs, $processor->get_breadcrumbs(), "Found incorrect breadcrumbs in {$html}." );
}

/**
Expand Down

0 comments on commit 8f11947

Please sign in to comment.