@@ -374,6 +374,9 @@ public function testRenameColumn(): void
374
374
375
375
public function testHasColumn (): void
376
376
{
377
+ $ this ->assertTrue (Schema::hasColumn ('newcollection ' , '_id ' ));
378
+ $ this ->assertTrue (Schema::hasColumn ('newcollection ' , 'id ' ));
379
+
377
380
DB ::connection ()->table ('newcollection ' )->insert (['column1 ' => 'value ' ]);
378
381
379
382
$ this ->assertTrue (Schema::hasColumn ('newcollection ' , 'column1 ' ));
@@ -382,6 +385,9 @@ public function testHasColumn(): void
382
385
383
386
public function testHasColumns (): void
384
387
{
388
+ $ this ->assertTrue (Schema::hasColumns ('newcollection ' , ['_id ' ]));
389
+ $ this ->assertTrue (Schema::hasColumns ('newcollection ' , ['id ' ]));
390
+
385
391
// Insert documents with both column1 and column2
386
392
DB ::connection ()->table ('newcollection ' )->insert ([
387
393
['column1 ' => 'value1 ' , 'column2 ' => 'value2 ' ],
@@ -451,8 +457,9 @@ public function testGetColumns()
451
457
$ this ->assertIsString ($ column ['comment ' ]);
452
458
});
453
459
454
- $ this ->assertEquals ('objectId ' , $ columns ->get ('_id ' )['type ' ]);
455
- $ this ->assertEquals ('objectId ' , $ columns ->get ('_id ' )['generation ' ]['type ' ]);
460
+ $ this ->assertNull ($ columns ->get ('_id ' ), '_id is renamed to id ' );
461
+ $ this ->assertEquals ('objectId ' , $ columns ->get ('id ' )['type ' ]);
462
+ $ this ->assertEquals ('objectId ' , $ columns ->get ('id ' )['generation ' ]['type ' ]);
456
463
$ this ->assertNull ($ columns ->get ('text ' )['generation ' ]);
457
464
$ this ->assertEquals ('string ' , $ columns ->get ('text ' )['type ' ]);
458
465
$ this ->assertEquals ('date ' , $ columns ->get ('date ' )['type ' ]);
0 commit comments