@@ -83,6 +83,24 @@ final class Operation
83
83
84
84
private ?string $ saveResultAsEntity = null ;
85
85
86
+ private static array $ unsupportedOperations = [
87
+ self ::OBJECT_TEST_RUNNER => [
88
+ 'assertNumberConnectionsCheckedOut ' => 'PHP does not implement CMAP ' ,
89
+ 'createEntities ' => 'createEntities is not implemented (PHPC-1760) ' ,
90
+ ],
91
+ Client::class => [
92
+ 'clientBulkWrite ' => 'clientBulkWrite is not implemented (PHPLIB-847) ' ,
93
+ 'listDatabaseObjects ' => 'listDatabaseObjects is not implemented ' ,
94
+ ],
95
+ Cursor::class => ['iterateOnce ' => 'iterateOnce is not implemented (PHPC-1760) ' ],
96
+ Database::class => [
97
+ 'createCommandCursor ' => 'commandCursor API is not yet implemented (PHPLIB-1077) ' ,
98
+ 'listCollectionObjects ' => 'listCollectionObjects is not implemented ' ,
99
+ 'runCursorCommand ' => 'commandCursor API is not yet implemented (PHPLIB-1077) ' ,
100
+ ],
101
+ Collection::class => ['listIndexNames ' => 'listIndexNames is not implemented ' ],
102
+ ];
103
+
86
104
public function __construct (stdClass $ o , private Context $ context )
87
105
{
88
106
$ this ->entityMap = $ context ->getEntityMap ();
@@ -166,6 +184,7 @@ private function execute()
166
184
$ object = $ this ->entityMap [$ this ->object ];
167
185
assertIsObject ($ object );
168
186
187
+ $ this ->skipIfOperationIsNotSupported ($ object ::class);
169
188
$ this ->context ->setActiveClient ($ this ->entityMap ->getRootClientIdOf ($ this ->object ));
170
189
171
190
switch ($ object ::class) {
@@ -235,10 +254,6 @@ private function executeForChangeStream(ChangeStream $changeStream)
235
254
236
255
private function executeForClient (Client $ client )
237
256
{
238
- if ($ this ->name === 'clientBulkWrite ' ) {
239
- Assert::markTestSkipped ('clientBulkWrite operation is not implemented ' );
240
- }
241
-
242
257
$ args = $ this ->prepareArguments ();
243
258
Util::assertArgumentsBySchema (Client::class, $ this ->name , $ args );
244
259
@@ -811,6 +826,8 @@ private function executeForBucket(Bucket $bucket)
811
826
812
827
private function executeForTestRunner ()
813
828
{
829
+ $ this ->skipIfOperationIsNotSupported (self ::OBJECT_TEST_RUNNER );
830
+
814
831
$ args = $ this ->prepareArguments ();
815
832
Util::assertArgumentsBySchema (self ::OBJECT_TEST_RUNNER , $ this ->name , $ args );
816
833
@@ -963,6 +980,16 @@ private function prepareArguments(): array
963
980
return Util::prepareCommonOptions ($ args );
964
981
}
965
982
983
+ private function skipIfOperationIsNotSupported (string $ executingObjectName ): void
984
+ {
985
+ $ skipReason = self ::$ unsupportedOperations [$ executingObjectName ][$ this ->name ] ?? null ;
986
+ if (! $ skipReason ) {
987
+ return ;
988
+ }
989
+
990
+ Assert::markTestSkipped ($ skipReason );
991
+ }
992
+
966
993
private static function prepareBulkWriteRequest (stdClass $ request ): array
967
994
{
968
995
$ request = (array ) $ request ;
0 commit comments