@@ -83,6 +83,26 @@ 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 => [
96
+ 'iterateOnce ' => 'iterateOnce is not implemented (PHPC-1760) ' ,
97
+ ],
98
+ Database::class => [
99
+ 'createCommandCursor ' => 'commandCursor API is not yet implemented (PHPLIB-1077) ' ,
100
+ 'listCollectionObjects ' => 'listCollectionObjects is not implemented ' ,
101
+ 'runCursorCommand ' => 'commandCursor API is not yet implemented (PHPLIB-1077) ' ,
102
+ ],
103
+ Collection::class => ['listIndexNames ' => 'listIndexNames is not implemented ' ],
104
+ ];
105
+
86
106
public function __construct (stdClass $ o , private Context $ context )
87
107
{
88
108
$ this ->entityMap = $ context ->getEntityMap ();
@@ -166,6 +186,7 @@ private function execute()
166
186
$ object = $ this ->entityMap [$ this ->object ];
167
187
assertIsObject ($ object );
168
188
189
+ $ this ->skipIfOperationIsNotSupported ($ object ::class);
169
190
$ this ->context ->setActiveClient ($ this ->entityMap ->getRootClientIdOf ($ this ->object ));
170
191
171
192
switch ($ object ::class) {
@@ -235,10 +256,6 @@ private function executeForChangeStream(ChangeStream $changeStream)
235
256
236
257
private function executeForClient (Client $ client )
237
258
{
238
- if ($ this ->name === 'clientBulkWrite ' ) {
239
- Assert::markTestSkipped ('clientBulkWrite operation is not implemented ' );
240
- }
241
-
242
259
$ args = $ this ->prepareArguments ();
243
260
Util::assertArgumentsBySchema (Client::class, $ this ->name , $ args );
244
261
@@ -811,6 +828,8 @@ private function executeForBucket(Bucket $bucket)
811
828
812
829
private function executeForTestRunner ()
813
830
{
831
+ $ this ->skipIfOperationIsNotSupported (self ::OBJECT_TEST_RUNNER );
832
+
814
833
$ args = $ this ->prepareArguments ();
815
834
Util::assertArgumentsBySchema (self ::OBJECT_TEST_RUNNER , $ this ->name , $ args );
816
835
@@ -963,6 +982,16 @@ private function prepareArguments(): array
963
982
return Util::prepareCommonOptions ($ args );
964
983
}
965
984
985
+ private function skipIfOperationIsNotSupported (string $ executingObjectName ): void
986
+ {
987
+ $ skipReason = self ::$ unsupportedOperations [$ executingObjectName ][$ this ->name ] ?? null ;
988
+ if (! $ skipReason ) {
989
+ return ;
990
+ }
991
+
992
+ Assert::markTestSkipped ($ skipReason );
993
+ }
994
+
966
995
private static function prepareBulkWriteRequest (stdClass $ request ): array
967
996
{
968
997
$ request = (array ) $ request ;
0 commit comments