Addshore has uploaded a new change for review. https://gerrit.wikimedia.org/r/154406
Change subject: AbstractTest makes sure total msg count is correct ...................................................................... AbstractTest makes sure total msg count is correct Previous to this there could be more errors in a file that we had not explicitly defined in our standard test and they would have just been ignored even though we had not said that we were expecting them Change-Id: Ie00d9e2d505fe210019f9ec8635875618ceb638c --- M AbstractStandardTestCase.php 1 file changed, 17 insertions(+), 0 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/tools/codesniffer refs/changes/06/154406/1 diff --git a/AbstractStandardTestCase.php b/AbstractStandardTestCase.php index efe3e29..23d80af 100644 --- a/AbstractStandardTestCase.php +++ b/AbstractStandardTestCase.php @@ -89,8 +89,11 @@ "Expected no errors but got some\n" . $outputStr ); } + + $totalExpectedMessages = 0; foreach( $resultMap as $messageType => $lineMap ) { foreach( $lineMap as $lineNumber => $messageCount ) { + $totalExpectedMessages += $messageCount; $regex = '/\s(' . $lineNumber . ')\s\|\s(' . $messageType . ')\s\|/i'; $this->assertEquals( $messageCount, @@ -105,6 +108,20 @@ ); } } + + preg_match( + '/FOUND\s(\d+)\s[\w\(\)]+\s(?:AND\s(\d+)\s[\w\(\)]+\s)?AFFECTING\s/', + $outputStr, + $summarymatches + ); + $totalMessages = intval( $summarymatches[1] ); + if( array_key_exists( 2, $summarymatches ) ) { + $totalMessages += intval( $summarymatches[2] ); + } + $this->assertEquals( + $totalExpectedMessages, + $totalMessages, + "Total message count incorrect: Expected:$totalExpectedMessages Got:$totalMessages" ); } } \ No newline at end of file -- To view, visit https://gerrit.wikimedia.org/r/154406 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: Ie00d9e2d505fe210019f9ec8635875618ceb638c Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/tools/codesniffer Gerrit-Branch: master Gerrit-Owner: Addshore <addshorew...@gmail.com> _______________________________________________ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits