17
17
use MongoDB \Operation \Count ;
18
18
use MongoDB \Tests \CommandObserver ;
19
19
use PHPUnit \Framework \Attributes \DataProvider ;
20
+ use ReflectionClass ;
20
21
use TypeError ;
21
22
22
23
use function array_filter ;
@@ -405,6 +406,16 @@ public function testWithOptionsInheritsOptions(): void
405
406
foreach ($ collectionOptions as $ key => $ value ) {
406
407
$ this ->assertSame ($ value , $ debug [$ key ]);
407
408
}
409
+
410
+ // autoEncryptionEnabled is an internal option not reported via debug info
411
+ $ collection = new Collection ($ this ->manager , $ this ->getDatabaseName (), $ this ->getCollectionName (), ['autoEncryptionEnabled ' => true ]);
412
+ $ clone = $ collection ->withOptions ();
413
+
414
+ $ rc = new ReflectionClass ($ clone );
415
+ $ rp = $ rc ->getProperty ('autoEncryptionEnabled ' );
416
+ $ rp ->setAccessible (true );
417
+
418
+ $ this ->assertSame (true , $ rp ->getValue ($ clone ));
408
419
}
409
420
410
421
public function testWithOptionsPassesOptions (): void
@@ -424,6 +435,15 @@ public function testWithOptionsPassesOptions(): void
424
435
foreach ($ collectionOptions as $ key => $ value ) {
425
436
$ this ->assertSame ($ value , $ debug [$ key ]);
426
437
}
438
+
439
+ // autoEncryptionEnabled is an internal option not reported via debug info
440
+ $ clone = $ this ->collection ->withOptions (['autoEncryptionEnabled ' => true ]);
441
+
442
+ $ rc = new ReflectionClass ($ clone );
443
+ $ rp = $ rc ->getProperty ('autoEncryptionEnabled ' );
444
+ $ rp ->setAccessible (true );
445
+
446
+ $ this ->assertSame (true , $ rp ->getValue ($ clone ));
427
447
}
428
448
429
449
public static function collectionMethodClosures ()
0 commit comments