@@ -107,8 +107,11 @@ public function testRenameCollectionExistingTarget(): void
107
107
108
108
$ this ->expectException (CommandException::class);
109
109
110
- // mongos returns an inconsistent error code (see: SERVER-60632)
111
- if (! $ this ->isShardedCluster ()) {
110
+ /* TODO: mongos returns an inconsistent error code (see: SERVER-60632)
111
+ *
112
+ * Note: pre-3.2 server versions omit an error code. libmongoc will
113
+ * substitute MONGOC_ERROR_QUERY_FAILURE in _mongoc_cmd_check_ok. */
114
+ if (! $ this ->isShardedCluster () && version_compare ($ this ->getServerVersion (), '3.2.0 ' , '>= ' )) {
112
115
$ this ->expectExceptionCode (self ::$ errorCodeNamespaceExists );
113
116
}
114
117
@@ -124,7 +127,13 @@ public function testRenameCollectionExistingTarget(): void
124
127
public function testRenameNonexistentCollection (): void
125
128
{
126
129
$ this ->expectException (CommandException::class);
127
- $ this ->expectExceptionCode (self ::$ errorCodeNamespaceNotFound );
130
+
131
+ /* Note: pre-3.2 server versions omit an error code. libmongoc will
132
+ * substitute MONGOC_ERROR_QUERY_FAILURE in _mongoc_cmd_check_ok */
133
+ if (version_compare ($ this ->getServerVersion (), '3.2.0 ' , '>= ' )) {
134
+ $ this ->expectExceptionCode (self ::$ errorCodeNamespaceNotFound );
135
+ }
136
+
128
137
$ operation = new RenameCollection (
129
138
$ this ->getDatabaseName (),
130
139
$ this ->getCollectionName (),
0 commit comments