1717use function collect ;
1818use function count ;
1919use function sprintf ;
20- use function str_starts_with ;
2120
2221class SchemaTest extends TestCase
2322{
@@ -399,9 +398,6 @@ public function testGetTables()
399398 DB ::connection ('mongodb ' )->table ('newcollection_two ' )->insert (['test ' => 'value ' ]);
400399 $ dbName = DB ::connection ('mongodb ' )->getDatabaseName ();
401400
402- // Create a view (this creates system.views)
403- DB ::connection ('mongodb ' )->getDatabase ()->createCollection ('test_view ' , ['viewOn ' => 'newcollection ' ]);
404-
405401 $ tables = Schema::getTables ();
406402 $ this ->assertIsArray ($ tables );
407403 $ this ->assertGreaterThanOrEqual (2 , count ($ tables ));
@@ -418,9 +414,6 @@ public function testGetTables()
418414 $ this ->assertEquals ($ dbName . '.newcollection ' , $ table ['schema_qualified_name ' ]);
419415 $ found = true ;
420416 }
421-
422- // Ensure system collections are excluded
423- $ this ->assertStringStartsNotWith ($ table ['name ' ], 'system. ' );
424417 }
425418
426419 if (! $ found ) {
@@ -452,9 +445,6 @@ public function testGetViews()
452445 $ this ->assertEquals ($ dbName . '.test_view ' , $ table ['schema_qualified_name ' ]);
453446 $ found = true ;
454447 }
455-
456- // Ensure system collections are excluded
457- $ this ->assertFalse (str_starts_with ($ table ['name ' ], 'system. ' ));
458448 }
459449
460450 if (! $ found ) {
@@ -467,18 +457,12 @@ public function testGetTableListing()
467457 DB ::connection ('mongodb ' )->table ('newcollection ' )->insert (['test ' => 'value ' ]);
468458 DB ::connection ('mongodb ' )->table ('newcollection_two ' )->insert (['test ' => 'value ' ]);
469459
470- // Create a view (this creates system.views)
471- DB ::connection ('mongodb ' )->getDatabase ()->createCollection ('test_view ' , ['viewOn ' => 'newcollection ' ]);
472-
473460 $ tables = Schema::getTableListing ();
474461
475462 $ this ->assertIsArray ($ tables );
476463 $ this ->assertGreaterThanOrEqual (2 , count ($ tables ));
477464 $ this ->assertContains ('newcollection ' , $ tables );
478465 $ this ->assertContains ('newcollection_two ' , $ tables );
479-
480- // Ensure system collections are excluded
481- $ this ->assertNotContains ('system.views ' , $ tables );
482466 }
483467
484468 public function testGetTableListingBySchema ()
@@ -502,28 +486,6 @@ public function testGetTableListingBySchema()
502486 $ this ->assertContains ('newcollection_two ' , $ tables );
503487 }
504488
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-
527489 public function testGetColumns ()
528490 {
529491 $ collection = DB ::connection ('mongodb ' )->table ('newcollection ' );
0 commit comments