Thiemo Mättig (WMDE) has uploaded a new change for review. https://gerrit.wikimedia.org/r/237372
Change subject: Replace some very simple asserttag with assertContains ...................................................................... Replace some very simple asserttag with assertContains See my comment in I36ad837 for the motivation why I touched this. Most other usages of assertTag in our code base are much more complicated and are not that easy to convert to something else. One could convert some to assertRegex, but I really want to avoid overly complex regular expressions. I suggest to rebase I36ad837 on top of this. Bug: T69122 Change-Id: Id016edf0cafdb2312299f658856491e08d634c5e --- M repo/tests/phpunit/includes/content/ItemContentTest.php M repo/tests/phpunit/includes/specials/SpecialGoToLinkedPageTest.php 2 files changed, 5 insertions(+), 11 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Wikibase refs/changes/72/237372/1 diff --git a/repo/tests/phpunit/includes/content/ItemContentTest.php b/repo/tests/phpunit/includes/content/ItemContentTest.php index e5aa7fc..10d1d09 100644 --- a/repo/tests/phpunit/includes/content/ItemContentTest.php +++ b/repo/tests/phpunit/includes/content/ItemContentTest.php @@ -401,8 +401,9 @@ $html = $parserOutput->getText(); - $this->assertTag( array( 'tag' => 'div', 'class' => 'redirectMsg' ), $html, 'redirect message' ); - $this->assertTag( array( 'tag' => 'a', 'content' => 'Q123' ), $html, 'redirect target' ); + $this->assertContains( '<div class="redirectMsg">', $html, 'redirect message' ); + $this->assertContains( '<a href="', $html, 'redirect target link' ); + $this->assertContains( 'Q123</a>', $html, 'redirect target label' ); } public function provideGetEntityId() { diff --git a/repo/tests/phpunit/includes/specials/SpecialGoToLinkedPageTest.php b/repo/tests/phpunit/includes/specials/SpecialGoToLinkedPageTest.php index 614ab52..59d3973 100644 --- a/repo/tests/phpunit/includes/specials/SpecialGoToLinkedPageTest.php +++ b/repo/tests/phpunit/includes/specials/SpecialGoToLinkedPageTest.php @@ -179,16 +179,9 @@ $this->assertTag( $matcher, $output, "Failed to match html output for: " . $key ); } - $errorMatch = array( - 'tag' => 'p', - 'content' => $error, - 'attributes' => array( - 'class' => 'error' - ) - ); - if ( !empty( $error ) ) { - $this->assertTag( $errorMatch, $output, "Failed to match error: " . $error ); + $this->assertContains( '<p class="error">' . $error . '</p>', $output, + 'Failed to match error: ' . $error ); } } -- To view, visit https://gerrit.wikimedia.org/r/237372 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: Id016edf0cafdb2312299f658856491e08d634c5e Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/extensions/Wikibase Gerrit-Branch: master Gerrit-Owner: Thiemo Mättig (WMDE) <thiemo.maet...@wikimedia.de> _______________________________________________ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits