From 162aea8dddef8cfacdbb0263862917e2df1311b3 Mon Sep 17 00:00:00 2001 From: Mior Muhammad Zaki Date: Thu, 5 May 2022 22:01:58 +0800 Subject: [PATCH] Add tests for `tap` usages on `DatabaseEngine` (#622) * Add tests for `tap` usages on `DatabaseEngine` * wip * Update DatabaseEngineTest.php --- tests/Feature/DatabaseEngineTest.php | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/tests/Feature/DatabaseEngineTest.php b/tests/Feature/DatabaseEngineTest.php index 91c89404..7694b534 100644 --- a/tests/Feature/DatabaseEngineTest.php +++ b/tests/Feature/DatabaseEngineTest.php @@ -118,4 +118,15 @@ public function test_limit_is_applied() $models = SearchableUserDatabaseModel::search('laravel')->take(1)->get(); $this->assertCount(1, $models); } + + public function test_tap_is_applied() + { + $models = SearchableUserDatabaseModel::search('laravel')->get(); + $this->assertCount(2, $models); + + $models = SearchableUserDatabaseModel::search('laravel')->tap(function ($query) { + return $query->take(1); + })->get(); + $this->assertCount(1, $models); + } }