Skip to content

Commit 7f5bb9a

Browse files
committed
PHPLIB-1080: Spec tests for command events databaseName property
1 parent cbc8104 commit 7f5bb9a

File tree

2 files changed

+21
-6
lines changed

2 files changed

+21
-6
lines changed

tests/UnifiedSpecTests/EventObserver.php

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -275,7 +275,7 @@ private function assertCommandStartedEvent(CommandStartedEvent $actual, stdClass
275275

276276
private function assertCommandSucceededEvent(CommandSucceededEvent $actual, stdClass $expected, string $message): void
277277
{
278-
Util::assertHasOnlyKeys($expected, ['reply', 'commandName', 'hasServiceId', 'hasServerConnectionId']);
278+
Util::assertHasOnlyKeys($expected, ['reply', 'commandName', 'databaseName', 'hasServiceId', 'hasServerConnectionId']);
279279

280280
if (isset($expected->reply)) {
281281
assertIsObject($expected->reply);
@@ -288,6 +288,11 @@ private function assertCommandSucceededEvent(CommandSucceededEvent $actual, stdC
288288
assertSame($actual->getCommandName(), $expected->commandName, $message . ': commandName matches');
289289
}
290290

291+
if (isset($expected->databaseName)) {
292+
assertIsString($expected->databaseName);
293+
assertSame($actual->getDatabaseName(), $expected->databaseName, $message . ': databaseName matches');
294+
}
295+
291296
if (isset($expected->hasServiceId)) {
292297
assertIsBool($expected->hasServiceId);
293298
assertSame($actual->getServiceId() !== null, $expected->hasServiceId, $message . ': hasServiceId matches');
@@ -301,13 +306,18 @@ private function assertCommandSucceededEvent(CommandSucceededEvent $actual, stdC
301306

302307
private function assertCommandFailedEvent(CommandFailedEvent $actual, stdClass $expected, string $message): void
303308
{
304-
Util::assertHasOnlyKeys($expected, ['commandName', 'hasServiceId', 'hasServerConnectionId']);
309+
Util::assertHasOnlyKeys($expected, ['commandName', 'databaseName', 'hasServiceId', 'hasServerConnectionId']);
305310

306311
if (isset($expected->commandName)) {
307312
assertIsString($expected->commandName);
308313
assertSame($actual->getCommandName(), $expected->commandName, $message . ': commandName matches');
309314
}
310315

316+
if (isset($expected->databaseName)) {
317+
assertIsString($expected->databaseName);
318+
assertSame($actual->getDatabaseName(), $expected->databaseName, $message . ': databaseName matches');
319+
}
320+
311321
if (isset($expected->hasServiceId)) {
312322
assertIsBool($expected->hasServiceId);
313323
assertSame($actual->getServiceId() !== null, $expected->hasServiceId, $message . ': hasServiceId matches');

tests/UnifiedSpecTests/UnifiedTestRunner.php

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -55,11 +55,16 @@ final class UnifiedTestRunner
5555

5656
public const MIN_SCHEMA_VERSION = '1.0';
5757

58-
/* Note: This is necessary to support expectedError.errorResponse from 1.12;
59-
* however, syntax from 1.9, 1.10, and 1.11 has not been fully implemented.
60-
* Syntax for 1.9 is partially implemented (createEntities operation).
58+
/**
59+
* Support for the following schema versions is incomplete:
60+
*
61+
* - 1.9: Only createEntities operation is implemented
62+
* - 1.10: Not implemented
63+
* - 1.11: Not implemented, but CMAP is not applicable
64+
* - 1.13: Not implemented
65+
* - 1.14: Not implemented
6166
*/
62-
public const MAX_SCHEMA_VERSION = '1.12';
67+
public const MAX_SCHEMA_VERSION = '1.15';
6368

6469
private Client $internalClient;
6570

0 commit comments

Comments
 (0)