Merge pull request #18159 from nextcloud/tests/comments-integration

Do not call count on null
This commit is contained in:
Roeland Jago Douma 2019-12-02 08:53:02 +01:00 committed by GitHub
commit 407c2c13ab
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 6 additions and 2 deletions

View File

@ -256,8 +256,12 @@ class CommentsContext implements \Behat\Behat\Context\Context {
* @throws \Exception * @throws \Exception
*/ */
public function theResponseShouldContainOnlyComments($number) { public function theResponseShouldContainOnlyComments($number) {
if (count($this->response) !== (int)$number) { $count = 0;
throw new \Exception("Found more comments than $number (" . count($this->response) . ")"); if ($this->response !== null) {
$count = count($this->response);
}
if ($count !== (int)$number) {
throw new \Exception("Found more comments than $number (" . $count . ")");
} }
} }