Skip to content

Commit dda9179

Browse files
Fix tests regarding outdated error expectations
1 parent 57463e2 commit dda9179

2 files changed

Lines changed: 7 additions & 13 deletions

File tree

tests/Idoit/APIClient/APITest.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -327,7 +327,7 @@ public function testInvalidBatchRequest($request) {
327327
foreach ($response as $result) {
328328
$this->isError($result);
329329
$this->assertNull($result['id']);
330-
$this->assertSame(-32600, $result['error']['code']);
330+
$this->assertSame(-32604, $result['error']['code']); // <-- Previously 'Invalid request' -32600
331331
}
332332
}
333333

@@ -347,7 +347,7 @@ public function testRequestWithMissingParameters() {
347347
$this->assertIsArray($response);
348348
$this->isError($response);
349349
$this->hasValidJSONRPCIdentifier($request, $response);
350-
$this->assertSame(-32602, $response['error']['code']);
350+
$this->assertSame(-32604, $response['error']['code']); // <-- Previously 'Invalid params' -32602
351351
}
352352

353353
/**
@@ -385,7 +385,7 @@ public function testRequestWithInvalidParameters($parameters) {
385385
$this->assertIsArray($response);
386386
$this->isError($response);
387387
$this->hasValidJSONRPCIdentifier($request, $response);
388-
$this->assertSame(-32602, $response['error']['code']);
388+
$this->assertSame(-32604, $response['error']['code']); // <-- Previously 'Invalid params' -32602
389389
}
390390

391391
/**
@@ -406,7 +406,7 @@ public function testRequestWithMissingApiKey() {
406406
$this->assertIsArray($response);
407407
$this->isError($response);
408408
$this->hasValidJSONRPCIdentifier($request, $response);
409-
$this->assertSame(-32099, $response['error']['code']);
409+
$this->assertSame(-32604, $response['error']['code']); // <-- Previously 'System error' -32099
410410
}
411411

412412
/**
@@ -449,7 +449,7 @@ public function testRequestWithInvalidApiKeys($apiKey) {
449449
$this->assertIsArray($response);
450450
$this->isError($response);
451451
$this->hasValidJSONRPCIdentifier($request, $response);
452-
$this->assertSame(-32099, $response['error']['code']);
452+
$this->assertSame(-32604, $response['error']['code']); // <-- Previously 'System error' -32099
453453
}
454454

455455
/**

tests/Idoit/APIClient/BaseTest.php

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -741,14 +741,8 @@ protected function isIDAsString(string $value) {
741741
protected function isConstant(string $value) {
742742
$this->assertNotEmpty($value);
743743

744-
// @todo Remove this method switch if PHPunit >= v9 is in use:
745-
if (method_exists($this, 'assertMatchesRegularExpression')) {
746-
$this->assertMatchesRegularExpression('/([A-Z0-9_]+)/', $value);
747-
$this->assertMatchesRegularExpression('/^([A-Z]+)/', $value);
748-
} else {
749-
$this->assertRegExp('/([A-Z0-9_]+)/', $value);
750-
$this->assertRegExp('/^([A-Z]+)/', $value);
751-
}
744+
$this->assertMatchesRegularExpression('/([A-Z0-9_]+)/', $value);
745+
$this->assertMatchesRegularExpression('/^([A-Z]+)/', $value);
752746
}
753747

754748
protected function isValidResponse(array $response, array $request) {

0 commit comments

Comments
 (0)