From dbf44b1be74f04f3f5d27e708bc5d7b96f59e969 Mon Sep 17 00:00:00 2001 From: Kunal Mehta Date: Fri, 12 Oct 2018 20:49:42 -0700 Subject: [PATCH] Don't call count() with a non-countable value Triggers a warning in PHP 7.2. Bug: T206541 Change-Id: I5c25b59cd91871fcdbbf73e01af5a61c05c5fffd --- tests/phpunit/gateway/UserNotificationGatewayTest.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tests/phpunit/gateway/UserNotificationGatewayTest.php b/tests/phpunit/gateway/UserNotificationGatewayTest.php index c1cf3babd..2cc4fd78b 100644 --- a/tests/phpunit/gateway/UserNotificationGatewayTest.php +++ b/tests/phpunit/gateway/UserNotificationGatewayTest.php @@ -121,9 +121,10 @@ class EchoUserNotificationGatewayTest extends MediaWikiTestCase { $db->expects( $this->any() ) ->method( 'selectRowCount' ) ->will( $this->returnValue( $dbResult['selectRowCount'] ) ); + $numRows = is_array( $dbResult['select'] ) ? count( $dbResult['select'] ) : 0; $db->expects( $this->any() ) ->method( 'numRows' ) - ->will( $this->returnValue( count( $dbResult['select'] ) ) ); + ->will( $this->returnValue( $numRows ) ); return $db; }