20
20
use MongoDB \Tests \CommandObserver ;
21
21
use PHPUnit \Framework \Attributes \DataProvider ;
22
22
use PHPUnit \Framework \Attributes \Group ;
23
+ use ReflectionClass ;
23
24
use TypeError ;
24
25
25
26
use function array_filter ;
@@ -396,6 +397,16 @@ public function testWithOptionsInheritsOptions(): void
396
397
foreach ($ collectionOptions as $ key => $ value ) {
397
398
$ this ->assertSame ($ value , $ debug [$ key ]);
398
399
}
400
+
401
+ // autoEncryptionEnabled is an internal option not reported via debug info
402
+ $ collection = new Collection ($ this ->manager , $ this ->getDatabaseName (), $ this ->getCollectionName (), ['autoEncryptionEnabled ' => true ]);
403
+ $ clone = $ collection ->withOptions ();
404
+
405
+ $ rc = new ReflectionClass ($ clone );
406
+ $ rp = $ rc ->getProperty ('autoEncryptionEnabled ' );
407
+ $ rp ->setAccessible (true );
408
+
409
+ $ this ->assertSame (true , $ rp ->getValue ($ clone ));
399
410
}
400
411
401
412
public function testWithOptionsPassesOptions (): void
@@ -415,6 +426,15 @@ public function testWithOptionsPassesOptions(): void
415
426
foreach ($ collectionOptions as $ key => $ value ) {
416
427
$ this ->assertSame ($ value , $ debug [$ key ]);
417
428
}
429
+
430
+ // autoEncryptionEnabled is an internal option not reported via debug info
431
+ $ clone = $ this ->collection ->withOptions (['autoEncryptionEnabled ' => true ]);
432
+
433
+ $ rc = new ReflectionClass ($ clone );
434
+ $ rp = $ rc ->getProperty ('autoEncryptionEnabled ' );
435
+ $ rp ->setAccessible (true );
436
+
437
+ $ this ->assertSame (true , $ rp ->getValue ($ clone ));
418
438
}
419
439
420
440
#[Group('matrix-testing-exclude-server-4.4-driver-4.0 ' )]
0 commit comments