File tree Expand file tree Collapse file tree 3 files changed +95
-0
lines changed Expand file tree Collapse file tree 3 files changed +95
-0
lines changed Original file line number Diff line number Diff line change @@ -125,6 +125,8 @@ public function run(UnifiedTestCase $test): void
125
125
*
126
126
* This function is primarily used by the Atlas testing workload executor.
127
127
*
128
+ * @see https://github.com/mongodb-labs/drivers-atlas-testing/
129
+ *
128
130
* @param callable(EntityMap):void $entityMapObserver
129
131
*/
130
132
public function setEntityMapObserver (callable $ entityMapObserver ): void
Original file line number Diff line number Diff line change
1
+ <?php
2
+
3
+ namespace MongoDB \Tests \UnifiedSpecTests ;
4
+
5
+ use MongoDB \Tests \FunctionalTestCase ;
6
+
7
+ class UnifiedTestRunnerTest extends FunctionalTestCase
8
+ {
9
+ public function testEntityMapObserver (): void
10
+ {
11
+ $ test = UnifiedTestCase::fromFile (__DIR__ . '/runner/entity-map-observer.json ' );
12
+ $ calls = 0 ;
13
+
14
+ $ runner = new UnifiedTestRunner (static ::getUri ());
15
+ $ runner ->setEntityMapObserver (function (EntityMap $ entityMap ) use (&$ calls ): void {
16
+ $ this ->assertArrayHasKey ('client0 ' , $ entityMap );
17
+ $ this ->assertArrayHasKey ('database0 ' , $ entityMap );
18
+ $ this ->assertArrayHasKey ('collection0 ' , $ entityMap );
19
+ $ calls ++;
20
+ });
21
+
22
+ $ runner ->run ($ test ->current ());
23
+ $ this ->assertSame (1 , $ calls );
24
+ }
25
+ }
Original file line number Diff line number Diff line change
1
+ {
2
+ "description" : " find" ,
3
+ "schemaVersion" : " 1.0" ,
4
+ "createEntities" : [
5
+ {
6
+ "client" : {
7
+ "id" : " client0" ,
8
+ "useMultipleMongoses" : true ,
9
+ "observeEvents" : [
10
+ " commandStartedEvent"
11
+ ]
12
+ }
13
+ },
14
+ {
15
+ "database" : {
16
+ "id" : " database0" ,
17
+ "client" : " client0" ,
18
+ "databaseName" : " runner-tests"
19
+ }
20
+ },
21
+ {
22
+ "collection" : {
23
+ "id" : " collection0" ,
24
+ "database" : " database0" ,
25
+ "collectionName" : " coll0"
26
+ }
27
+ }
28
+ ],
29
+ "initialData" : [
30
+ {
31
+ "collectionName" : " coll0" ,
32
+ "databaseName" : " runner-tests" ,
33
+ "documents" : []
34
+ }
35
+ ],
36
+ "tests" : [
37
+ {
38
+ "description" : " basic find" ,
39
+ "operations" : [
40
+ {
41
+ "name" : " find" ,
42
+ "arguments" : {
43
+ "filter" : {}
44
+ },
45
+ "object" : " collection0" ,
46
+ "expectResult" : []
47
+ }
48
+ ],
49
+ "expectEvents" : [
50
+ {
51
+ "client" : " client0" ,
52
+ "events" : [
53
+ {
54
+ "commandStartedEvent" : {
55
+ "command" : {
56
+ "find" : " coll0" ,
57
+ "filter" : {}
58
+ },
59
+ "commandName" : " find" ,
60
+ "databaseName" : " runner-tests"
61
+ }
62
+ }
63
+ ]
64
+ }
65
+ ]
66
+ }
67
+ ]
68
+ }
You can’t perform that action at this time.
0 commit comments