From 330cb7047e7160431bb6a3c6ec0c596d1ecd9b11 Mon Sep 17 00:00:00 2001 From: Julius Härtl Date: Fri, 29 Nov 2019 09:59:35 +0100 Subject: Do not call count on null MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Julius Härtl --- build/integration/features/bootstrap/CommentsContext.php | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'build') diff --git a/build/integration/features/bootstrap/CommentsContext.php b/build/integration/features/bootstrap/CommentsContext.php index ce05b56689d..262ffc92b88 100644 --- a/build/integration/features/bootstrap/CommentsContext.php +++ b/build/integration/features/bootstrap/CommentsContext.php @@ -256,8 +256,12 @@ class CommentsContext implements \Behat\Behat\Context\Context { * @throws \Exception */ public function theResponseShouldContainOnlyComments($number) { - if (count($this->response) !== (int)$number) { - throw new \Exception("Found more comments than $number (" . count($this->response) . ")"); + $count = 0; + if ($this->response !== null) { + $count = count($this->response); + } + if ($count !== (int)$number) { + throw new \Exception("Found more comments than $number (" . $count . ")"); } } -- cgit v1.2.3