@@ -110,17 +110,42 @@ public static function assertCommandMatches(stdClass $expected, stdClass $actual
110
110
static ::assertDocumentsMatch ($ expected , $ actual );
111
111
}
112
112
113
+ /**
114
+ * @dataProvider provideTransactionsTests
115
+ */
116
+ public function testTransactions (stdClass $ test , ?array $ runOn = null , array $ data , ?string $ databaseName = null , ?string $ collectionName = null ): void
117
+ {
118
+ $ this ->runTransactionTest ($ test , $ runOn , $ data , $ databaseName , $ collectionName );
119
+ }
120
+
121
+ public function provideTransactionsTests (): array
122
+ {
123
+ return $ this ->provideTests ('transactions ' );
124
+ }
125
+
126
+ /**
127
+ * @dataProvider provideTransactionsConvenientApiTests
128
+ */
129
+ public function testTransactionsConvenientApi (stdClass $ test , ?array $ runOn = null , array $ data , ?string $ databaseName = null , ?string $ collectionName = null ): void
130
+ {
131
+ $ this ->runTransactionTest ($ test , $ runOn , $ data , $ databaseName , $ collectionName );
132
+ }
133
+
134
+ public function provideTransactionsConvenientApiTests (): array
135
+ {
136
+ return $ this ->provideTests ('transactions-convenient-api ' );
137
+ }
138
+
113
139
/**
114
140
* Execute an individual test case from the specification.
115
141
*
116
- * @dataProvider provideTests
117
142
* @param stdClass $test Individual "tests[]" document
118
143
* @param array $runOn Top-level "runOn" array with server requirements
119
144
* @param array $data Top-level "data" array to initialize collection
120
145
* @param string $databaseName Name of database under test
121
146
* @param string $collectionName Name of collection under test
122
147
*/
123
- public function testTransactions (stdClass $ test , ?array $ runOn = null , array $ data , ?string $ databaseName = null , ?string $ collectionName = null ): void
148
+ private function runTransactionTest (stdClass $ test , ?array $ runOn = null , array $ data , ?string $ databaseName = null , ?string $ collectionName = null ): void
124
149
{
125
150
if (isset (self ::$ incompleteTests [$ this ->dataDescription ()])) {
126
151
$ this ->markTestIncomplete (self ::$ incompleteTests [$ this ->dataDescription ()]);
@@ -173,11 +198,11 @@ public function testTransactions(stdClass $test, ?array $runOn = null, array $da
173
198
}
174
199
}
175
200
176
- public function provideTests ()
201
+ private function provideTests (string $ dir ): array
177
202
{
178
203
$ testArgs = [];
179
204
180
- foreach (glob (__DIR__ . '/transactions* /*.json ' ) as $ filename ) {
205
+ foreach (glob (__DIR__ . '/ ' . $ dir . ' /*.json ' ) as $ filename ) {
181
206
$ json = $ this ->decodeJson (file_get_contents ($ filename ));
182
207
$ group = basename (dirname ($ filename )) . '/ ' . basename ($ filename , '.json ' );
183
208
$ runOn = $ json ->runOn ?? null ;
0 commit comments