Skip to content

Commit 7593bda

Browse files
committed
Fixed wrong order of parameters for some tests. This didn't have much impact on the test itself, but it was confusing when an actual value was treated as an expected and vice versa.
1 parent cf8c84b commit 7593bda

17 files changed

+403
-365
lines changed

.idea/php.xml

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

tests/AqlUserFunctionTest.php

+20-20
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ public function testRegisterListAndUnRegisterAqlUserFunctionWithInitialConfig()
8181
$result = $userFunction->register();
8282

8383
static::assertEquals(
84-
$result['error'], false, 'result[\'error\'] Did not return false, instead returned: ' . print_r($result, 1)
84+
false, $result['error'], 'result[\'error\'] Did not return false, instead returned: ' . print_r($result, 1)
8585
);
8686
$list = $this->filter($userFunction->getRegisteredUserFunctions());
8787

@@ -95,7 +95,7 @@ public function testRegisterListAndUnRegisterAqlUserFunctionWithInitialConfig()
9595
$result = $userFunction->unregister();
9696

9797
static::assertEquals(
98-
$result['error'], false, 'result[\'error\'] Did not return false, instead returned: ' . print_r($result, 1)
98+
false, $result['error'], 'result[\'error\'] Did not return false, instead returned: ' . print_r($result, 1)
9999
);
100100
}
101101

@@ -113,7 +113,7 @@ public function testRegisterListAndUnRegisterAqlUserFunctionUsingShortcut()
113113
$result = $userFunction->register($name, $code);
114114

115115
static::assertEquals(
116-
$result['error'], false, 'result[\'error\'] Did not return false, instead returned: ' . print_r($result, 1)
116+
false, $result['error'], 'result[\'error\'] Did not return false, instead returned: ' . print_r($result, 1)
117117
);
118118
$list = $this->filter($userFunction->getRegisteredUserFunctions());
119119

@@ -126,7 +126,7 @@ public function testRegisterListAndUnRegisterAqlUserFunctionUsingShortcut()
126126
$result = $userFunction->unregister($name);
127127

128128
static::assertEquals(
129-
$result['error'], false, 'result[\'error\'] Did not return false, instead returned: ' . print_r($result, 1)
129+
false, $result['error'], 'result[\'error\'] Did not return false, instead returned: ' . print_r($result, 1)
130130
);
131131
}
132132

@@ -146,28 +146,28 @@ public function testRegisterListAndUnRegisterAqlUserFunctionWithGettersAndSetter
146146

147147
// check if getters work fine
148148
static::assertEquals(
149-
$userFunction->getName(), $name, 'Did not return name, instead returned: ' . $userFunction->getName()
149+
$name, $userFunction->getName(), 'Did not return name, instead returned: ' . $userFunction->getName()
150150
);
151151
static::assertEquals(
152-
$userFunction->getCode(), $code, 'Did not return code, instead returned: ' . $userFunction->getCode()
152+
$code, $userFunction->getCode(), 'Did not return code, instead returned: ' . $userFunction->getCode()
153153
);
154154

155155

156156
// also check setters/getters if wrong/no attribute is given
157157
static::assertEquals(
158-
$userFunction->getFakeAttributeName, null, 'Getter with unknown attribute did not return null, instead returned: ' . $userFunction->getFakeAttributeName
158+
null, $userFunction->getFakeAttributeName, 'Getter with unknown attribute did not return null, instead returned: ' . $userFunction->getFakeAttributeName
159159
);
160160

161161
static::assertEquals(
162-
$userFunction->setFakeAttributeName, null, 'Setter with unknown attribute did not return chainable object, instead returned..: ' . $userFunction->setFakeAttributeName
162+
null, $userFunction->setFakeAttributeName, 'Setter with unknown attribute did not return chainable object, instead returned..: ' . $userFunction->setFakeAttributeName
163163
);
164164

165165
// Check setting/getting class properties via set/get methods
166166
static::assertSame(
167-
$userFunction->set('FakeAttributeName', 1), $userFunction, 'Set-method did not return chainable object'
167+
$userFunction, $userFunction->set('FakeAttributeName', 1), 'Set-method did not return chainable object'
168168
);
169169
static::assertSame(
170-
$userFunction->get('FakeAttributeName'), 1, 'Get-method did not return previously set property'
170+
1, $userFunction->get('FakeAttributeName'), 'Get-method did not return previously set property'
171171
);
172172

173173
// Check giving the set method a non-string key
@@ -184,7 +184,7 @@ public function testRegisterListAndUnRegisterAqlUserFunctionWithGettersAndSetter
184184
$result = $userFunction->register();
185185

186186
static::assertEquals(
187-
$result['error'], false, 'result[\'error\'] Did not return false, instead returned: ' . print_r($result, 1)
187+
false, $result['error'], 'result[\'error\'] Did not return false, instead returned: ' . print_r($result, 1)
188188
);
189189
$list = $this->filter($userFunction->getRegisteredUserFunctions());
190190
static::assertCount(1, $list, 'List returned did not return expected 1 attribute');
@@ -196,7 +196,7 @@ public function testRegisterListAndUnRegisterAqlUserFunctionWithGettersAndSetter
196196
$result = $userFunction->unregister();
197197

198198
static::assertEquals(
199-
$result['error'], false, 'result[\'error\'] Did not return false, instead returned: ' . print_r($result, 1)
199+
false, $result['error'], 'result[\'error\'] Did not return false, instead returned: ' . print_r($result, 1)
200200
);
201201
}
202202

@@ -218,16 +218,16 @@ public function testRegisterListAndUnRegisterAqlUserFunctionWithWithMagicSetters
218218

219219
// check if getters work fine
220220
static::assertEquals(
221-
$userFunction->name, $name, 'Did not return name, instead returned: ' . $userFunction->name
221+
$name, $userFunction->name, 'Did not return name, instead returned: ' . $userFunction->name
222222
);
223223
static::assertEquals(
224-
$userFunction->code, $code, 'Did not return code, instead returned: ' . $userFunction->code
224+
$code, $userFunction->code, 'Did not return code, instead returned: ' . $userFunction->code
225225
);
226226

227227
$result = $userFunction->register();
228228

229229
static::assertEquals(
230-
$result['error'], false, 'result[\'error\'] Did not return false, instead returned: ' . print_r($result, 1)
230+
false, $result['error'], 'result[\'error\'] Did not return false, instead returned: ' . print_r($result, 1)
231231
);
232232
$list = $this->filter($userFunction->getRegisteredUserFunctions());
233233
static::assertCount(1, $list, 'List returned did not return expected 1 attribute');
@@ -239,7 +239,7 @@ public function testRegisterListAndUnRegisterAqlUserFunctionWithWithMagicSetters
239239
$result = $userFunction->unregister();
240240

241241
static::assertEquals(
242-
$result['error'], false, 'result[\'error\'] Did not return false, instead returned: ' . print_r($result, 1)
242+
false, $result['error'], 'result[\'error\'] Did not return false, instead returned: ' . print_r($result, 1)
243243
);
244244
}
245245

@@ -263,13 +263,13 @@ public function testReRegisterListAndUnRegisterAqlUserFunctionTwice()
263263
$result = $userFunction->register();
264264

265265
static::assertEquals(
266-
$result['error'], false, 'result[\'error\'] Did not return false, instead returned: ' . print_r($result, 1)
266+
false, $result['error'], 'result[\'error\'] Did not return false, instead returned: ' . print_r($result, 1)
267267
);
268268

269269
$result = $userFunction->register();
270270

271271
static::assertEquals(
272-
$result['error'], false, 'result[\'error\'] Did not return false, instead returned: ' . print_r($result, 1)
272+
false, $result['error'], 'result[\'error\'] Did not return false, instead returned: ' . print_r($result, 1)
273273
);
274274

275275
$list = $this->filter($userFunction->getRegisteredUserFunctions());
@@ -282,7 +282,7 @@ public function testReRegisterListAndUnRegisterAqlUserFunctionTwice()
282282
$result = $userFunction->unregister();
283283

284284
static::assertEquals(
285-
$result['error'], false, 'result[\'error\'] Did not return false, instead returned: ' . print_r($result, 1)
285+
false, $result['error'], 'result[\'error\'] Did not return false, instead returned: ' . print_r($result, 1)
286286
);
287287

288288
$e = null;
@@ -292,7 +292,7 @@ public function testReRegisterListAndUnRegisterAqlUserFunctionTwice()
292292
}
293293

294294
static::assertEquals(
295-
$e->getCode(), 404, 'Did not return code 404, instead returned: ' . $e->getCode()
295+
404, $e->getCode(), 'Did not return code 404, instead returned: ' . $e->getCode()
296296
);
297297
}
298298

tests/BatchTest.php

+5-5
Original file line numberDiff line numberDiff line change
@@ -203,7 +203,7 @@ public function testCreateDocumentBatchWithDefinedBatchSize()
203203

204204
static::assertInstanceOf(BatchPart::class, $documentId, 'Did not return a BatchPart Object!');
205205

206-
static::assertEquals($batch->getConnectionCaptureMode($this->connection), true);
206+
static::assertEquals(true, $batch->getConnectionCaptureMode($this->connection));
207207

208208
$batch->stopCapture();
209209

@@ -288,12 +288,12 @@ public function testCreateMixedBatchWithPartIds()
288288

289289
$resultingCollectionId = $batch->getProcessedPartResponse('testCollection1');
290290
$testCollection1Part = $batch->getPart('testCollection1');
291-
static::assertEquals($testCollection1Part->getHttpCode(), 200, 'Did not return an HttpCode 200!');
291+
static::assertEquals(200, $testCollection1Part->getHttpCode(), 'Did not return an HttpCode 200!');
292292
$resultingCollection = $collectionHandler->get($batch->getProcessedPartResponse('testCollection1'));
293293

294294
$resultingAttribute = $resultingCollection->getName();
295295
static::assertSame(
296-
$name, $resultingAttribute, 'The created collection name and resulting collection name do not match!'
296+
$resultingAttribute, $name, 'The created collection name and resulting collection name do not match!'
297297
);
298298

299299
static::assertEquals(Collection::getDefaultType(), $resultingCollection->getType());
@@ -309,7 +309,7 @@ public function testCreateMixedBatchWithPartIds()
309309
);
310310
$documentBatchPart = $documentHandler->save($resultingCollectionId, $document);
311311

312-
static::assertEquals($documentBatchPart->getType(), 'document');
312+
static::assertEquals('document', $documentBatchPart->getType());
313313

314314
static::assertInstanceOf(BatchPart::class, $documentBatchPart, 'Did not return a BatchPart Object!');
315315

@@ -366,7 +366,7 @@ public function testCreateMixedBatchWithPartIds()
366366
is_a($edge, HttpResponse::class),
367367
'Edge batch creation did return an error: ' . print_r($edge, true)
368368
);
369-
static::assertNotSame($edge, '', 'Edge batch creation did return empty string: ' . print_r($edge, true));
369+
static::assertNotSame('', $edge, 'Edge batch creation did return empty string: ' . print_r($edge, true));
370370

371371

372372
$batch = new Batch($this->connection);

tests/CollectionBasicTest.php

+22-20
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ public function testCreateAndDeleteCollectionPre1_2()
111111

112112
$resultingAttribute = $resultingCollection->getName();
113113
static::assertSame(
114-
$name, $resultingAttribute, 'The created collection name and resulting collection name do not match!'
114+
$resultingAttribute, $name, 'The created collection name and resulting collection name do not match!'
115115
);
116116

117117
static::assertEquals(Collection::getDefaultType(), $resultingCollection->getType());
@@ -150,25 +150,25 @@ public function testCreateCollectionWithKeyOptionsAndVerifyProperties()
150150
$resultingCollection = $collectionHandler->getProperties($response);
151151
$properties = $resultingCollection->getAll();
152152

153-
static::assertEquals($properties[Collection::ENTRY_STATUS], 3, 'Status does not match.');
153+
static::assertEquals(3, $properties[Collection::ENTRY_STATUS], 'Status does not match.');
154154
static::assertEquals(
155-
$properties[Collection::ENTRY_KEY_OPTIONS]['type'],
156155
'autoincrement',
156+
$properties[Collection::ENTRY_KEY_OPTIONS]['type'],
157157
'Key options type does not match'
158158
);
159159
static::assertEquals(
160-
$properties[Collection::ENTRY_KEY_OPTIONS]['allowUserKeys'],
161160
false,
161+
$properties[Collection::ENTRY_KEY_OPTIONS]['allowUserKeys'],
162162
'Key options allowUserKeys does not match'
163163
);
164164
static::assertEquals(
165-
$properties[Collection::ENTRY_KEY_OPTIONS]['increment'],
166165
5,
166+
$properties[Collection::ENTRY_KEY_OPTIONS]['increment'],
167167
'Key options increment does not match'
168168
);
169169
static::assertEquals(
170-
$properties[Collection::ENTRY_KEY_OPTIONS]['offset'],
171170
10,
171+
$properties[Collection::ENTRY_KEY_OPTIONS]['offset'],
172172
'Key options offset does not match'
173173
);
174174
$collectionHandler->drop($collection);
@@ -207,7 +207,7 @@ public function testCreateCollectionWithKeyOptionsCluster()
207207
} catch (\Exception $e) {
208208
}
209209

210-
static::assertEquals($e->getCode(), 501);
210+
static::assertEquals(501, $e->getCode());
211211
}
212212

213213

@@ -241,8 +241,8 @@ public function testCreateCollectionWithNumberOfShardsCluster()
241241
$resultingCollection = $collectionHandler->getProperties($response);
242242
$properties = $resultingCollection->getAll();
243243

244-
static::assertEquals($properties[Collection::ENTRY_NUMBER_OF_SHARDS], 4, 'Number of shards does not match.');
245-
static::assertEquals($properties[Collection::ENTRY_SHARD_KEYS], ['_key'], 'Shard keys do not match.');
244+
static::assertEquals(4, $properties[Collection::ENTRY_NUMBER_OF_SHARDS], 'Number of shards does not match.');
245+
static::assertEquals(['_key'], $properties[Collection::ENTRY_SHARD_KEYS], 'Shard keys do not match.');
246246
}
247247

248248

@@ -276,13 +276,15 @@ public function testCreateCollectionWithShardKeysCluster()
276276
$resultingCollection = $collectionHandler->getProperties($response);
277277
$properties = $resultingCollection->getAll();
278278

279-
static::assertEquals($properties[Collection::ENTRY_NUMBER_OF_SHARDS], 1, 'Number of shards does not match.');
279+
static::assertEquals(1, $properties[Collection::ENTRY_NUMBER_OF_SHARDS], 'Number of shards does not match.');
280280
static::assertEquals(
281-
$properties[Collection::ENTRY_SHARD_KEYS], [
282-
'_key',
283-
'a',
284-
'b'
285-
], 'Shard keys do not match.'
281+
[
282+
'_key',
283+
'a',
284+
'b'
285+
],
286+
$properties[Collection::ENTRY_SHARD_KEYS],
287+
'Shard keys do not match.'
286288
);
287289
}
288290

@@ -311,7 +313,7 @@ public function testCreateAndDeleteCollection()
311313

312314
$resultingAttribute = $resultingCollection->getName();
313315
static::assertSame(
314-
$name, $resultingAttribute, 'The created collection name and resulting collection name do not match!'
316+
$resultingAttribute, $name, 'The created collection name and resulting collection name do not match!'
315317
);
316318

317319
static::assertEquals(Collection::getDefaultType(), $resultingCollection->getType());
@@ -345,7 +347,7 @@ public function testCreateAndDeleteEdgeCollection()
345347

346348
$resultingAttribute = $resultingCollection->getName();
347349
static::assertSame(
348-
$name, $resultingAttribute, 'The created collection name and resulting collection name do not match!'
350+
$resultingAttribute, $name, 'The created collection name and resulting collection name do not match!'
349351
);
350352

351353
static::assertEquals(Collection::TYPE_EDGE, $resultingCollection->getType());
@@ -377,7 +379,7 @@ public function testCreateAndDeleteEdgeCollectionWithoutCreatingObject()
377379

378380
$resultingAttribute = $resultingCollection->getName();
379381
static::assertSame(
380-
$name, $resultingAttribute, 'The created collection name and resulting collection name do not match!'
382+
$resultingAttribute, $name, 'The created collection name and resulting collection name do not match!'
381383
);
382384

383385
static::assertEquals(Collection::TYPE_EDGE, $resultingCollection->getType());
@@ -408,7 +410,7 @@ public function testCreateAndDeleteVolatileCollectionWithoutCreatingObject()
408410

409411
$resultingAttribute = $resultingCollection->getName();
410412
static::assertSame(
411-
$name, $resultingAttribute, 'The created collection name and resulting collection name do not match!'
413+
$resultingAttribute, $name, 'The created collection name and resulting collection name do not match!'
412414
);
413415
$resultingCollectionProperties = $collectionHandler->getProperties($name);
414416
static::assertTrue($resultingCollectionProperties->getIsVolatile());
@@ -440,7 +442,7 @@ public function testCreateAndDeleteSystemCollectionWithoutCreatingObject()
440442

441443
$resultingAttribute = $resultingCollection->getName();
442444
static::assertSame(
443-
$name, $resultingAttribute, 'The created collection name and resulting collection name do not match!'
445+
$resultingAttribute, $name, 'The created collection name and resulting collection name do not match!'
444446
);
445447
$resultingCollectionProperties = $collectionHandler->getProperties($name);
446448
static::assertTrue($resultingCollectionProperties->getIsSystem());

0 commit comments

Comments
 (0)