Skip to content

Commit 019460c

Browse files
committed
Add assertion on _id field
1 parent 69969ec commit 019460c

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

tests/QueryBuilderTest.php

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -465,10 +465,17 @@ public function testCustomId()
465465
$item = DB::table('items')->where('id', 'fork')->first();
466466
$this->assertEquals('fork', $item->id);
467467

468+
$item = DB::table('items')->where('_id', 'fork')->first();
469+
$this->assertEquals('fork', $item->id);
470+
468471
// tags.id is translated into tags._id in query
469472
$items = DB::table('items')->whereIn('tags.id', ['sharp'])->get();
470473
$this->assertCount(2, $items);
471474

475+
// Ensure the field _id is stored in the database
476+
$items = DB::table('items')->whereIn('tags._id', ['sharp'])->get();
477+
$this->assertCount(2, $items);
478+
472479
DB::table('users')->insert([
473480
['id' => 1, 'name' => 'Jane Doe'],
474481
['id' => 2, 'name' => 'John Doe'],

0 commit comments

Comments
 (0)