File tree Expand file tree Collapse file tree 2 files changed +35
-0
lines changed Expand file tree Collapse file tree 2 files changed +35
-0
lines changed Original file line number Diff line number Diff line change 27
27
28
28
use function assert ;
29
29
use function iterator_to_array ;
30
+ use function sprintf ;
31
+ use function trigger_error ;
32
+
33
+ use const E_USER_WARNING ;
30
34
31
35
/**
32
36
* @template TValue of object
@@ -104,6 +108,7 @@ public function rewind(): void
104
108
public function setTypeMap (array $ typemap ): void
105
109
{
106
110
// Not supported
111
+ trigger_error (sprintf ('Discarding type map for %s ' , __METHOD__ ), E_USER_WARNING );
107
112
}
108
113
109
114
/** @return array<int, TValue> */
Original file line number Diff line number Diff line change
1
+ <?php
2
+
3
+ namespace MongoDB \Tests \Model ;
4
+
5
+ use MongoDB \Codec \DocumentCodec ;
6
+ use MongoDB \Model \CodecCursor ;
7
+ use MongoDB \Tests \FunctionalTestCase ;
8
+
9
+ class CodecCursorFunctionalTest extends FunctionalTestCase
10
+ {
11
+ public function setUp (): void
12
+ {
13
+ parent ::setUp ();
14
+
15
+ $ this ->dropCollection ($ this ->getDatabaseName (), $ this ->getCollectionName ());
16
+ }
17
+
18
+ public function testSetTypeMap (): void
19
+ {
20
+ $ collection = self ::createTestClient ()->selectCollection ($ this ->getDatabaseName (), $ this ->getCollectionName ());
21
+ $ cursor = $ collection ->find ();
22
+
23
+ $ codecCursor = CodecCursor::fromCursor ($ cursor , $ this ->createMock (DocumentCodec::class));
24
+
25
+ $ this ->expectWarning ();
26
+ $ this ->expectWarningMessage ('Discarding type map for MongoDB\Model\CodecCursor::setTypeMap ' );
27
+
28
+ $ codecCursor ->setTypeMap (['root ' => 'array ' ]);
29
+ }
30
+ }
You can’t perform that action at this time.
0 commit comments