Skip to content

Commit dfd77e6

Browse files
authored
PHPLIB-841: Tests for aggregate allowDiskUse option (#913)
Synced with mongodb/specifications@53b7f16
1 parent aefff4c commit dfd77e6

31 files changed

+6870
-105
lines changed

tests/UnifiedSpecTests/UnifiedSpecTest.php

+84
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,90 @@ class UnifiedSpecTest extends FunctionalTestCase
6161
'valid-pass/entity-client-cmap-events: events are captured during an operation' => 'PHPC does not implement CMAP',
6262
'valid-pass/expectedEventsForClient-eventType: eventType can be set to command and cmap' => 'PHPC does not implement CMAP',
6363
'valid-pass/expectedEventsForClient-eventType: eventType defaults to command if unset' => 'PHPC does not implement CMAP',
64+
// CRUD "comment" option is not yet implemented
65+
'crud/bulkWrite-comment: BulkWrite with string comment' => 'Not yet implemented (PHPC-2049, PHPLIB-749)',
66+
'crud/bulkWrite-comment: BulkWrite with document comment' => 'Not yet implemented (PHPC-2049, PHPLIB-749)',
67+
'crud/bulkWrite-comment: BulkWrite with comment - pre 4.4' => 'Not yet implemented (PHPC-2049, PHPLIB-749)',
68+
'crud/deleteMany-comment: deleteMany with string comment' => 'Not yet implemented (PHPC-2049, PHPLIB-749)',
69+
'crud/deleteMany-comment: deleteMany with document comment' => 'Not yet implemented (PHPC-2049, PHPLIB-749)',
70+
'crud/deleteMany-comment: deleteMany with comment - pre 4.4' => 'Not yet implemented (PHPC-2049, PHPLIB-749)',
71+
'crud/deleteOne-comment: deleteOne with string comment' => 'Not yet implemented (PHPC-2049, PHPLIB-749)',
72+
'crud/deleteOne-comment: deleteOne with document comment' => 'Not yet implemented (PHPC-2049, PHPLIB-749)',
73+
'crud/deleteOne-comment: deleteOne with comment - pre 4.4' => 'Not yet implemented (PHPC-2049, PHPLIB-749)',
74+
'crud/find-comment: find with string comment' => 'Not yet implemented (PHPC-2049, PHPLIB-749)',
75+
'crud/find-comment: find with document comment' => 'Not yet implemented (PHPC-2049, PHPLIB-749)',
76+
'crud/find-comment: find with document comment - pre 4.4' => 'Not yet implemented (PHPC-2049, PHPLIB-749)',
77+
'crud/find-comment: find with comment sets comment on getMore' => 'Not yet implemented (PHPC-2049, PHPLIB-749)',
78+
'crud/findOneAndDelete-comment: findOneAndDelete with string comment' => 'Not yet implemented (PHPC-2049, PHPLIB-749)',
79+
'crud/findOneAndDelete-comment: findOneAndDelete with document comment' => 'Not yet implemented (PHPC-2049, PHPLIB-749)',
80+
'crud/findOneAndDelete-comment: findOneAndDelete with comment - pre 4.4' => 'Not yet implemented (PHPC-2049, PHPLIB-749)',
81+
'crud/findOneAndReplace-comment: findOneAndReplace with string comment' => 'Not yet implemented (PHPC-2049, PHPLIB-749)',
82+
'crud/findOneAndReplace-comment: findOneAndReplace with document comment' => 'Not yet implemented (PHPC-2049, PHPLIB-749)',
83+
'crud/findOneAndReplace-comment: findOneAndReplace with comment - pre 4.4' => 'Not yet implemented (PHPC-2049, PHPLIB-749)',
84+
'crud/findOneAndUpdate-comment: findOneAndUpdate with string comment' => 'Not yet implemented (PHPC-2049, PHPLIB-749)',
85+
'crud/findOneAndUpdate-comment: findOneAndUpdate with document comment' => 'Not yet implemented (PHPC-2049, PHPLIB-749)',
86+
'crud/findOneAndUpdate-comment: findOneAndUpdate with comment - pre 4.4' => 'Not yet implemented (PHPC-2049, PHPLIB-749)',
87+
'crud/insertMany-comment: insertMany with string comment' => 'Not yet implemented (PHPC-2049, PHPLIB-749)',
88+
'crud/insertMany-comment: insertMany with document comment' => 'Not yet implemented (PHPC-2049, PHPLIB-749)',
89+
'crud/insertMany-comment: insertMany with comment - pre 4.4' => 'Not yet implemented (PHPC-2049, PHPLIB-749)',
90+
'crud/insertOne-comment: insertOne with string comment' => 'Not yet implemented (PHPC-2049, PHPLIB-749)',
91+
'crud/insertOne-comment: insertOne with document comment' => 'Not yet implemented (PHPC-2049, PHPLIB-749)',
92+
'crud/insertOne-comment: insertOne with comment - pre 4.4' => 'Not yet implemented (PHPC-2049, PHPLIB-749)',
93+
'crud/replaceOne-comment: ReplaceOne with string comment' => 'Not yet implemented (PHPC-2049, PHPLIB-749)',
94+
'crud/replaceOne-comment: ReplaceOne with document comment' => 'Not yet implemented (PHPC-2049, PHPLIB-749)',
95+
'crud/replaceOne-comment: ReplaceOne with comment - pre 4.4' => 'Not yet implemented (PHPC-2049, PHPLIB-749)',
96+
'crud/updateMany-comment: UpdateMany with string comment' => 'Not yet implemented (PHPC-2049, PHPLIB-749)',
97+
'crud/updateMany-comment: UpdateMany with document comment' => 'Not yet implemented (PHPC-2049, PHPLIB-749)',
98+
'crud/updateMany-comment: UpdateMany with comment - pre 4.4' => 'Not yet implemented (PHPC-2049, PHPLIB-749)',
99+
'crud/updateOne-comment: UpdateOne with string comment' => 'Not yet implemented (PHPC-2049, PHPLIB-749)',
100+
'crud/updateOne-comment: UpdateOne with document comment' => 'Not yet implemented (PHPC-2049, PHPLIB-749)',
101+
'crud/updateOne-comment: UpdateOne with comment - pre 4.4' => 'Not yet implemented (PHPC-2049, PHPLIB-749)',
102+
'crud/aggregate: aggregate with comment sets comment on getMore' => 'Not yet implemented (PHPC-2049, PHPLIB-749)',
103+
'crud/aggregate: aggregate with a document comment' => 'Not yet implemented (PHPC-2049, PHPLIB-749)',
104+
'crud/aggregate: aggregate with a document comment - pre 4.4' => 'Not yet implemented (PHPC-2049, PHPLIB-749)',
105+
// CRUD "let" option is not yet implemented
106+
'crud/BulkWrite deleteMany-let: BulkWrite deleteMany-let' => 'Not yet implemented (PHPLIB-748)',
107+
'crud/BulkWrite deleteMany-let: BulkWrite deleteMany with let option' => 'Not yet implemented (PHPLIB-748)',
108+
'crud/BulkWrite deleteMany-let: BulkWrite deleteMany with let option unsupported (server-side error)' => 'Not yet implemented (PHPLIB-748)',
109+
'crud/BulkWrite deleteOne-let: BulkWrite deleteOne-let' => 'Not yet implemented (PHPLIB-748)',
110+
'crud/BulkWrite deleteOne-let: BulkWrite deleteOne with let option' => 'Not yet implemented (PHPLIB-748)',
111+
'crud/BulkWrite deleteOne-let: BulkWrite deleteOne with let option unsupported (server-side error)' => 'Not yet implemented (PHPLIB-748)',
112+
'crud/BulkWrite replaceOne-let: BulkWrite replaceOne-let' => 'Not yet implemented (PHPLIB-748)',
113+
'crud/BulkWrite replaceOne-let: BulkWrite replaceOne with let option' => 'Not yet implemented (PHPLIB-748)',
114+
'crud/BulkWrite replaceOne-let: BulkWrite replaceOne with let option unsupported (server-side error)' => 'Not yet implemented (PHPLIB-748)',
115+
'crud/BulkWrite updateMany-let: BulkWrite updateMany-let' => 'Not yet implemented (PHPLIB-748)',
116+
'crud/BulkWrite updateMany-let: BulkWrite updateMany with let option' => 'Not yet implemented (PHPLIB-748)',
117+
'crud/BulkWrite updateMany-let: BulkWrite updateMany with let option unsupported (server-side error)' => 'Not yet implemented (PHPLIB-748)',
118+
'crud/BulkWrite updateOne-let: BulkWrite updateOne-let' => 'Not yet implemented (PHPLIB-748)',
119+
'crud/BulkWrite updateOne-let: BulkWrite updateOne with let option' => 'Not yet implemented (PHPLIB-748)',
120+
'crud/BulkWrite updateOne-let: BulkWrite updateOne with let option unsupported (server-side error)' => 'Not yet implemented (PHPLIB-748)',
121+
'crud/deleteMany-let: deleteMany-let' => 'Not yet implemented (PHPLIB-748)',
122+
'crud/deleteMany-let: deleteMany with let option' => 'Not yet implemented (PHPLIB-748)',
123+
'crud/deleteMany-let: deleteMany with let option unsupported (server-side error)' => 'Not yet implemented (PHPLIB-748)',
124+
'crud/deleteOne-let: deleteOne-let' => 'Not yet implemented (PHPLIB-748)',
125+
'crud/deleteOne-let: deleteOne with let option' => 'Not yet implemented (PHPLIB-748)',
126+
'crud/deleteOne-let: deleteOne with let option unsupported (server-side error)' => 'Not yet implemented (PHPLIB-748)',
127+
'crud/find-let: find-let' => 'Not yet implemented (PHPLIB-748)',
128+
'crud/find-let: Find with let option' => 'Not yet implemented (PHPLIB-748)',
129+
'crud/find-let: Find with let option unsupported (server-side error)' => 'Not yet implemented (PHPLIB-748)',
130+
'crud/findOneAndDelete-let: findOneAndDelete-let' => 'Not yet implemented (PHPLIB-748)',
131+
'crud/findOneAndDelete-let: findOneAndDelete with let option' => 'Not yet implemented (PHPLIB-748)',
132+
'crud/findOneAndDelete-let: findOneAndDelete with let option unsupported (server-side error)' => 'Not yet implemented (PHPLIB-748)',
133+
'crud/findOneAndReplace-let: findOneAndReplace-let' => 'Not yet implemented (PHPLIB-748)',
134+
'crud/findOneAndReplace-let: findOneAndReplace with let option' => 'Not yet implemented (PHPLIB-748)',
135+
'crud/findOneAndReplace-let: findOneAndReplace with let option unsupported (server-side error)' => 'Not yet implemented (PHPLIB-748)',
136+
'crud/findOneAndUpdate-let: findOneAndUpdate-let' => 'Not yet implemented (PHPLIB-748)',
137+
'crud/findOneAndUpdate-let: findOneAndUpdate with let option' => 'Not yet implemented (PHPLIB-748)',
138+
'crud/findOneAndUpdate-let: findOneAndUpdate with let option unsupported (server-side error)' => 'Not yet implemented (PHPLIB-748)',
139+
'crud/replaceOne-let: replaceOne-let' => 'Not yet implemented (PHPLIB-748)',
140+
'crud/replaceOne-let: ReplaceOne with let option' => 'Not yet implemented (PHPLIB-748)',
141+
'crud/replaceOne-let: ReplaceOne with let option unsupported (server-side error)' => 'Not yet implemented (PHPLIB-748)',
142+
'crud/updateMany-let: updateMany-let' => 'Not yet implemented (PHPLIB-748)',
143+
'crud/updateMany-let: updateMany with let option' => 'Not yet implemented (PHPLIB-748)',
144+
'crud/updateMany-let: updateMany with let option unsupported (server-side error)' => 'Not yet implemented (PHPLIB-748)',
145+
'crud/updateOne-let: updateOne-let' => 'Not yet implemented (PHPLIB-748)',
146+
'crud/updateOne-let: UpdateOne with let option' => 'Not yet implemented (PHPLIB-748)',
147+
'crud/updateOne-let: UpdateOne with let option unsupported (server-side error)' => 'Not yet implemented (PHPLIB-748)',
64148
];
65149

66150
/** @var UnifiedTestRunner */
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,155 @@
1+
{
2+
"description": "aggregate-allowdiskuse",
3+
"schemaVersion": "1.0",
4+
"createEntities": [
5+
{
6+
"client": {
7+
"id": "client0",
8+
"observeEvents": [
9+
"commandStartedEvent"
10+
]
11+
}
12+
},
13+
{
14+
"database": {
15+
"id": "database0",
16+
"client": "client0",
17+
"databaseName": "crud-tests"
18+
}
19+
},
20+
{
21+
"collection": {
22+
"id": "collection0",
23+
"database": "database0",
24+
"collectionName": "coll0"
25+
}
26+
}
27+
],
28+
"initialData": [
29+
{
30+
"collectionName": "coll0",
31+
"databaseName": "crud-tests",
32+
"documents": []
33+
}
34+
],
35+
"tests": [
36+
{
37+
"description": "Aggregate does not send allowDiskUse when value is not specified",
38+
"operations": [
39+
{
40+
"object": "collection0",
41+
"name": "aggregate",
42+
"arguments": {
43+
"pipeline": [
44+
{
45+
"$match": {}
46+
}
47+
]
48+
}
49+
}
50+
],
51+
"expectEvents": [
52+
{
53+
"client": "client0",
54+
"events": [
55+
{
56+
"commandStartedEvent": {
57+
"command": {
58+
"aggregate": "coll0",
59+
"pipeline": [
60+
{
61+
"$match": {}
62+
}
63+
],
64+
"allowDiskUse": {
65+
"$$exists": false
66+
}
67+
},
68+
"commandName": "aggregate",
69+
"databaseName": "crud-tests"
70+
}
71+
}
72+
]
73+
}
74+
]
75+
},
76+
{
77+
"description": "Aggregate sends allowDiskUse false when false is specified",
78+
"operations": [
79+
{
80+
"object": "collection0",
81+
"name": "aggregate",
82+
"arguments": {
83+
"pipeline": [
84+
{
85+
"$match": {}
86+
}
87+
],
88+
"allowDiskUse": false
89+
}
90+
}
91+
],
92+
"expectEvents": [
93+
{
94+
"client": "client0",
95+
"events": [
96+
{
97+
"commandStartedEvent": {
98+
"command": {
99+
"aggregate": "coll0",
100+
"pipeline": [
101+
{
102+
"$match": {}
103+
}
104+
],
105+
"allowDiskUse": false
106+
},
107+
"commandName": "aggregate",
108+
"databaseName": "crud-tests"
109+
}
110+
}
111+
]
112+
}
113+
]
114+
},
115+
{
116+
"description": "Aggregate sends allowDiskUse true when true is specified",
117+
"operations": [
118+
{
119+
"object": "collection0",
120+
"name": "aggregate",
121+
"arguments": {
122+
"pipeline": [
123+
{
124+
"$match": {}
125+
}
126+
],
127+
"allowDiskUse": true
128+
}
129+
}
130+
],
131+
"expectEvents": [
132+
{
133+
"client": "client0",
134+
"events": [
135+
{
136+
"commandStartedEvent": {
137+
"command": {
138+
"aggregate": "coll0",
139+
"pipeline": [
140+
{
141+
"$match": {}
142+
}
143+
],
144+
"allowDiskUse": true
145+
},
146+
"commandName": "aggregate",
147+
"databaseName": "crud-tests"
148+
}
149+
}
150+
]
151+
}
152+
]
153+
}
154+
]
155+
}

tests/UnifiedSpecTests/crud/aggregate-let.json

-103
Original file line numberDiff line numberDiff line change
@@ -56,109 +56,6 @@
5656
"minServerVersion": "5.0"
5757
}
5858
],
59-
"operations": [
60-
{
61-
"name": "aggregate",
62-
"object": "collection0",
63-
"arguments": {
64-
"pipeline": [
65-
{
66-
"$match": {
67-
"$expr": {
68-
"$eq": [
69-
"$_id",
70-
"$$id"
71-
]
72-
}
73-
}
74-
},
75-
{
76-
"$project": {
77-
"_id": 0,
78-
"x": "$$x",
79-
"y": "$$y",
80-
"rand": "$$rand"
81-
}
82-
}
83-
],
84-
"let": {
85-
"id": 1,
86-
"x": "foo",
87-
"y": {
88-
"$literal": "bar"
89-
},
90-
"rand": {
91-
"$rand": {}
92-
}
93-
}
94-
},
95-
"expectResult": [
96-
{
97-
"x": "foo",
98-
"y": "bar",
99-
"rand": {
100-
"$$type": "double"
101-
}
102-
}
103-
]
104-
}
105-
],
106-
"expectEvents": [
107-
{
108-
"client": "client0",
109-
"events": [
110-
{
111-
"commandStartedEvent": {
112-
"command": {
113-
"aggregate": "coll0",
114-
"pipeline": [
115-
{
116-
"$match": {
117-
"$expr": {
118-
"$eq": [
119-
"$_id",
120-
"$$id"
121-
]
122-
}
123-
}
124-
},
125-
{
126-
"$project": {
127-
"_id": 0,
128-
"x": "$$x",
129-
"y": "$$y",
130-
"rand": "$$rand"
131-
}
132-
}
133-
],
134-
"let": {
135-
"id": 1,
136-
"x": "foo",
137-
"y": {
138-
"$literal": "bar"
139-
},
140-
"rand": {
141-
"$rand": {}
142-
}
143-
}
144-
}
145-
}
146-
}
147-
]
148-
}
149-
]
150-
},
151-
{
152-
"description": "Aggregate with let option and dollar-prefixed $literal value",
153-
"runOnRequirements": [
154-
{
155-
"minServerVersion": "5.0",
156-
"topologies": [
157-
"single",
158-
"replicaset"
159-
]
160-
}
161-
],
16259
"operations": [
16360
{
16461
"name": "aggregate",

0 commit comments

Comments
 (0)