17
17
use function collect ;
18
18
use function count ;
19
19
use function sprintf ;
20
- use function str_starts_with ;
21
20
22
21
class SchemaTest extends TestCase
23
22
{
@@ -399,9 +398,6 @@ public function testGetTables()
399
398
DB ::connection ('mongodb ' )->table ('newcollection_two ' )->insert (['test ' => 'value ' ]);
400
399
$ dbName = DB ::connection ('mongodb ' )->getDatabaseName ();
401
400
402
- // Create a view (this creates system.views)
403
- DB ::connection ('mongodb ' )->getDatabase ()->createCollection ('test_view ' , ['viewOn ' => 'newcollection ' ]);
404
-
405
401
$ tables = Schema::getTables ();
406
402
$ this ->assertIsArray ($ tables );
407
403
$ this ->assertGreaterThanOrEqual (2 , count ($ tables ));
@@ -418,9 +414,6 @@ public function testGetTables()
418
414
$ this ->assertEquals ($ dbName . '.newcollection ' , $ table ['schema_qualified_name ' ]);
419
415
$ found = true ;
420
416
}
421
-
422
- // Ensure system collections are excluded
423
- $ this ->assertStringStartsNotWith ($ table ['name ' ], 'system. ' );
424
417
}
425
418
426
419
if (! $ found ) {
@@ -452,9 +445,6 @@ public function testGetViews()
452
445
$ this ->assertEquals ($ dbName . '.test_view ' , $ table ['schema_qualified_name ' ]);
453
446
$ found = true ;
454
447
}
455
-
456
- // Ensure system collections are excluded
457
- $ this ->assertFalse (str_starts_with ($ table ['name ' ], 'system. ' ));
458
448
}
459
449
460
450
if (! $ found ) {
@@ -467,18 +457,12 @@ public function testGetTableListing()
467
457
DB ::connection ('mongodb ' )->table ('newcollection ' )->insert (['test ' => 'value ' ]);
468
458
DB ::connection ('mongodb ' )->table ('newcollection_two ' )->insert (['test ' => 'value ' ]);
469
459
470
- // Create a view (this creates system.views)
471
- DB ::connection ('mongodb ' )->getDatabase ()->createCollection ('test_view ' , ['viewOn ' => 'newcollection ' ]);
472
-
473
460
$ tables = Schema::getTableListing ();
474
461
475
462
$ this ->assertIsArray ($ tables );
476
463
$ this ->assertGreaterThanOrEqual (2 , count ($ tables ));
477
464
$ this ->assertContains ('newcollection ' , $ tables );
478
465
$ this ->assertContains ('newcollection_two ' , $ tables );
479
-
480
- // Ensure system collections are excluded
481
- $ this ->assertNotContains ('system.views ' , $ tables );
482
466
}
483
467
484
468
public function testGetTableListingBySchema ()
@@ -502,28 +486,6 @@ public function testGetTableListingBySchema()
502
486
$ this ->assertContains ('newcollection_two ' , $ tables );
503
487
}
504
488
505
- public function testSystemCollectionsArePresentButFiltered ()
506
- {
507
- // Create a view to trigger system.views collection
508
- DB ::connection ('mongodb ' )->getDatabase ()->createCollection ('test_view ' , ['viewOn ' => 'newcollection ' ]);
509
-
510
- // Get all collections directly from MongoDB
511
- $ allCollections = DB ::connection ('mongodb ' )->getDatabase ()->listCollectionNames ();
512
-
513
- // Ensure the system.views collection exists in MongoDB
514
- $ this ->assertContains ('system.views ' , $ allCollections );
515
-
516
- // Ensure Schema::getTables does NOT include system collections
517
- $ tables = Schema::getTables ();
518
- foreach ($ tables as $ table ) {
519
- $ this ->assertStringStartsNotWith ($ table ['name ' ], 'system. ' );
520
- }
521
-
522
- // Ensure Schema::getTableListing does NOT include system collections
523
- $ tableListing = Schema::getTableListing ();
524
- $ this ->assertNotContains ('system.views ' , $ tableListing );
525
- }
526
-
527
489
public function testGetColumns ()
528
490
{
529
491
$ collection = DB ::connection ('mongodb ' )->table ('newcollection ' );
0 commit comments