Skip to content

Commit cb4910c

Browse files
committed
(style): Rename parser test methods to camelCase
1 parent fe50ab2 commit cb4910c

4 files changed

Lines changed: 118 additions & 118 deletions

File tree

tests/Query/Parser/MongoDBTest.php

Lines changed: 36 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -69,186 +69,186 @@ private function encodeBsonDocument(array $doc): string
6969

7070
// -- Read Commands --
7171

72-
public function test_find_command(): void
72+
public function testFindCommand(): void
7373
{
7474
$data = $this->buildOpMsg(['find' => 'users', '$db' => 'mydb']);
7575
$this->assertSame(Type::Read, $this->parser->parse($data));
7676
}
7777

78-
public function test_aggregate_command(): void
78+
public function testAggregateCommand(): void
7979
{
8080
$data = $this->buildOpMsg(['aggregate' => 'users', '$db' => 'mydb']);
8181
$this->assertSame(Type::Read, $this->parser->parse($data));
8282
}
8383

84-
public function test_count_command(): void
84+
public function testCountCommand(): void
8585
{
8686
$data = $this->buildOpMsg(['count' => 'users', '$db' => 'mydb']);
8787
$this->assertSame(Type::Read, $this->parser->parse($data));
8888
}
8989

90-
public function test_distinct_command(): void
90+
public function testDistinctCommand(): void
9191
{
9292
$data = $this->buildOpMsg(['distinct' => 'users', 'key' => 'name', '$db' => 'mydb']);
9393
$this->assertSame(Type::Read, $this->parser->parse($data));
9494
}
9595

96-
public function test_list_collections_command(): void
96+
public function testListCollectionsCommand(): void
9797
{
9898
$data = $this->buildOpMsg(['listCollections' => 1, '$db' => 'mydb']);
9999
$this->assertSame(Type::Read, $this->parser->parse($data));
100100
}
101101

102-
public function test_list_databases_command(): void
102+
public function testListDatabasesCommand(): void
103103
{
104104
$data = $this->buildOpMsg(['listDatabases' => 1, '$db' => 'admin']);
105105
$this->assertSame(Type::Read, $this->parser->parse($data));
106106
}
107107

108-
public function test_list_indexes_command(): void
108+
public function testListIndexesCommand(): void
109109
{
110110
$data = $this->buildOpMsg(['listIndexes' => 'users', '$db' => 'mydb']);
111111
$this->assertSame(Type::Read, $this->parser->parse($data));
112112
}
113113

114-
public function test_db_stats_command(): void
114+
public function testDbStatsCommand(): void
115115
{
116116
$data = $this->buildOpMsg(['dbStats' => 1, '$db' => 'mydb']);
117117
$this->assertSame(Type::Read, $this->parser->parse($data));
118118
}
119119

120-
public function test_coll_stats_command(): void
120+
public function testCollStatsCommand(): void
121121
{
122122
$data = $this->buildOpMsg(['collStats' => 'users', '$db' => 'mydb']);
123123
$this->assertSame(Type::Read, $this->parser->parse($data));
124124
}
125125

126-
public function test_explain_command(): void
126+
public function testExplainCommand(): void
127127
{
128128
$data = $this->buildOpMsg(['explain' => 'users', '$db' => 'mydb']);
129129
$this->assertSame(Type::Read, $this->parser->parse($data));
130130
}
131131

132-
public function test_get_more_command(): void
132+
public function testGetMoreCommand(): void
133133
{
134134
$data = $this->buildOpMsg(['getMore' => 12345, '$db' => 'mydb']);
135135
$this->assertSame(Type::Read, $this->parser->parse($data));
136136
}
137137

138-
public function test_server_status_command(): void
138+
public function testServerStatusCommand(): void
139139
{
140140
$data = $this->buildOpMsg(['serverStatus' => 1, '$db' => 'admin']);
141141
$this->assertSame(Type::Read, $this->parser->parse($data));
142142
}
143143

144-
public function test_ping_command(): void
144+
public function testPingCommand(): void
145145
{
146146
$data = $this->buildOpMsg(['ping' => 1, '$db' => 'admin']);
147147
$this->assertSame(Type::Read, $this->parser->parse($data));
148148
}
149149

150-
public function test_hello_command(): void
150+
public function testHelloCommand(): void
151151
{
152152
$data = $this->buildOpMsg(['hello' => 1, '$db' => 'admin']);
153153
$this->assertSame(Type::Read, $this->parser->parse($data));
154154
}
155155

156-
public function test_is_master_command(): void
156+
public function testIsMasterCommand(): void
157157
{
158158
$data = $this->buildOpMsg(['isMaster' => 1, '$db' => 'admin']);
159159
$this->assertSame(Type::Read, $this->parser->parse($data));
160160
}
161161

162162
// -- Write Commands --
163163

164-
public function test_insert_command(): void
164+
public function testInsertCommand(): void
165165
{
166166
$data = $this->buildOpMsg(['insert' => 'users', '$db' => 'mydb']);
167167
$this->assertSame(Type::Write, $this->parser->parse($data));
168168
}
169169

170-
public function test_update_command(): void
170+
public function testUpdateCommand(): void
171171
{
172172
$data = $this->buildOpMsg(['update' => 'users', '$db' => 'mydb']);
173173
$this->assertSame(Type::Write, $this->parser->parse($data));
174174
}
175175

176-
public function test_delete_command(): void
176+
public function testDeleteCommand(): void
177177
{
178178
$data = $this->buildOpMsg(['delete' => 'users', '$db' => 'mydb']);
179179
$this->assertSame(Type::Write, $this->parser->parse($data));
180180
}
181181

182-
public function test_find_and_modify_command(): void
182+
public function testFindAndModifyCommand(): void
183183
{
184184
$data = $this->buildOpMsg(['findAndModify' => 'users', '$db' => 'mydb']);
185185
$this->assertSame(Type::Write, $this->parser->parse($data));
186186
}
187187

188-
public function test_create_command(): void
188+
public function testCreateCommand(): void
189189
{
190190
$data = $this->buildOpMsg(['create' => 'new_collection', '$db' => 'mydb']);
191191
$this->assertSame(Type::Write, $this->parser->parse($data));
192192
}
193193

194-
public function test_drop_command(): void
194+
public function testDropCommand(): void
195195
{
196196
$data = $this->buildOpMsg(['drop' => 'users', '$db' => 'mydb']);
197197
$this->assertSame(Type::Write, $this->parser->parse($data));
198198
}
199199

200-
public function test_create_indexes_command(): void
200+
public function testCreateIndexesCommand(): void
201201
{
202202
$data = $this->buildOpMsg(['createIndexes' => 'users', '$db' => 'mydb']);
203203
$this->assertSame(Type::Write, $this->parser->parse($data));
204204
}
205205

206-
public function test_drop_indexes_command(): void
206+
public function testDropIndexesCommand(): void
207207
{
208208
$data = $this->buildOpMsg(['dropIndexes' => 'users', '$db' => 'mydb']);
209209
$this->assertSame(Type::Write, $this->parser->parse($data));
210210
}
211211

212-
public function test_drop_database_command(): void
212+
public function testDropDatabaseCommand(): void
213213
{
214214
$data = $this->buildOpMsg(['dropDatabase' => 1, '$db' => 'mydb']);
215215
$this->assertSame(Type::Write, $this->parser->parse($data));
216216
}
217217

218-
public function test_rename_collection_command(): void
218+
public function testRenameCollectionCommand(): void
219219
{
220220
$data = $this->buildOpMsg(['renameCollection' => 'users', '$db' => 'admin']);
221221
$this->assertSame(Type::Write, $this->parser->parse($data));
222222
}
223223

224224
// -- Transaction Commands --
225225

226-
public function test_start_transaction(): void
226+
public function testStartTransaction(): void
227227
{
228228
$data = $this->buildOpMsg(['find' => 'users', '$db' => 'mydb', 'startTransaction' => true]);
229229
$this->assertSame(Type::TransactionBegin, $this->parser->parse($data));
230230
}
231231

232-
public function test_commit_transaction(): void
232+
public function testCommitTransaction(): void
233233
{
234234
$data = $this->buildOpMsg(['commitTransaction' => 1, '$db' => 'admin']);
235235
$this->assertSame(Type::TransactionEnd, $this->parser->parse($data));
236236
}
237237

238-
public function test_abort_transaction(): void
238+
public function testAbortTransaction(): void
239239
{
240240
$data = $this->buildOpMsg(['abortTransaction' => 1, '$db' => 'admin']);
241241
$this->assertSame(Type::TransactionEnd, $this->parser->parse($data));
242242
}
243243

244244
// -- Edge Cases --
245245

246-
public function test_too_short_packet(): void
246+
public function testTooShortPacket(): void
247247
{
248248
$this->assertSame(Type::Unknown, $this->parser->parse("\x00\x00\x00\x00"));
249249
}
250250

251-
public function test_wrong_opcode(): void
251+
public function testWrongOpcode(): void
252252
{
253253
// Build a packet with opcode 2004 (OP_QUERY, legacy) instead of 2013
254254
$bson = $this->encodeBsonDocument(['find' => 'users']);
@@ -261,13 +261,13 @@ public function test_wrong_opcode(): void
261261
$this->assertSame(Type::Unknown, $this->parser->parse($header . $body));
262262
}
263263

264-
public function test_unknown_command(): void
264+
public function testUnknownCommand(): void
265265
{
266266
$data = $this->buildOpMsg(['customCommand' => 1, '$db' => 'mydb']);
267267
$this->assertSame(Type::Unknown, $this->parser->parse($data));
268268
}
269269

270-
public function test_empty_bson_document(): void
270+
public function testEmptyBsonDocument(): void
271271
{
272272
// OP_MSG with an empty BSON document (just 5 bytes: length + terminator)
273273
$bson = \pack('V', 5) . "\x00";
@@ -280,19 +280,19 @@ public function test_empty_bson_document(): void
280280
$this->assertSame(Type::Unknown, $this->parser->parse($header . $body));
281281
}
282282

283-
public function test_classify_sql_returns_unknown(): void
283+
public function testClassifySqlReturnsUnknown(): void
284284
{
285285
$this->assertSame(Type::Unknown, $this->parser->classifySQL('SELECT * FROM users'));
286286
}
287287

288-
public function test_extract_keyword_returns_empty(): void
288+
public function testExtractKeywordReturnsEmpty(): void
289289
{
290290
$this->assertSame('', $this->parser->extractKeyword('SELECT'));
291291
}
292292

293293
// -- Performance --
294294

295-
public function test_parse_performance(): void
295+
public function testParsePerformance(): void
296296
{
297297
$data = $this->buildOpMsg(['find' => 'users', '$db' => 'mydb']);
298298
$iterations = 100_000;
@@ -311,7 +311,7 @@ public function test_parse_performance(): void
311311
);
312312
}
313313

314-
public function test_transaction_scan_performance(): void
314+
public function testTransactionScanPerformance(): void
315315
{
316316
// Document with many keys before startTransaction to test scanning
317317
$data = $this->buildOpMsg([

0 commit comments

Comments
 (0)