From 297b93de0774e0b357d7ca1417b45e510db078e8 Mon Sep 17 00:00:00 2001 From: Craig Morris Date: Mon, 30 Sep 2019 17:52:01 +0100 Subject: [PATCH] Apply limit to database rather than collection For HasInDatabase.php --- .../Foundation/Testing/Constraints/HasInDatabase.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Illuminate/Foundation/Testing/Constraints/HasInDatabase.php b/src/Illuminate/Foundation/Testing/Constraints/HasInDatabase.php index b88f34222872..66867e30ac05 100644 --- a/src/Illuminate/Foundation/Testing/Constraints/HasInDatabase.php +++ b/src/Illuminate/Foundation/Testing/Constraints/HasInDatabase.php @@ -75,13 +75,13 @@ public function failureDescription($table): string */ protected function getAdditionalInfo($table) { - $results = $this->database->table($table)->get(); + $results = $this->database->table($table)->limit($this->show)->get(); if ($results->isEmpty()) { return 'The table is empty'; } - $description = 'Found: '.json_encode($results->take($this->show), JSON_PRETTY_PRINT); + $description = 'Found: '.json_encode($results, JSON_PRETTY_PRINT); if ($results->count() > $this->show) { $description .= sprintf(' and %s others', $results->count() - $this->show);