mirror of
https://github.com/Dolibarr/dolibarr.git
synced 2025-12-05 17:18:13 +01:00
Fix phpunit
This commit is contained in:
@@ -137,7 +137,7 @@ class RestAPIContactTest extends PHPUnit\Framework\TestCase
|
||||
$object = json_decode($result['content'], true); // If success content is just an id, if not an array
|
||||
|
||||
$this->assertNotNull($object, "Parsing of json result must not be null");
|
||||
$this->assertNotEquals(500, $object['error']['code'], $object['error']['code'].' '.$object['error']['message']);
|
||||
$this->assertNotEquals(500, $object['error']['code'], (string) $object['error']['message']);
|
||||
$this->assertEquals('200', $object['success']['code']);
|
||||
|
||||
$this->api_key = $object['success']['token'];
|
||||
@@ -218,7 +218,7 @@ class RestAPIContactTest extends PHPUnit\Framework\TestCase
|
||||
$this->assertEquals($result['curl_error_no'], '');
|
||||
$object = json_decode($result['content'], true); // If success content is just an id, if not an array
|
||||
$this->assertNotNull($object, "Parsing of json result must no be null");
|
||||
$this->assertEquals(400, $object['error']['code'], $object['error']['code'].' '.$object['error']['message']);
|
||||
$this->assertEquals(400, (empty($object['error']['code']) ? 0 : $object['error']['code']), (string) $object['error']['message']);
|
||||
|
||||
$idofcontactcreated = (int) $object;
|
||||
|
||||
@@ -238,8 +238,8 @@ class RestAPIContactTest extends PHPUnit\Framework\TestCase
|
||||
|
||||
$object = json_decode($result['content'], true); // If success content is just an id, if not an array
|
||||
$this->assertNotNull($object, "Parsing of json result must not be null");
|
||||
$this->assertNotEquals(500, $object['error']['code'], $object['error']['code'].' '.$object['error']['message']);
|
||||
$this->assertGreaterThan(0, $object, $object['error']['code'].' '.$object['error']['message']);
|
||||
$this->assertNotEquals(500, (empty($object['error']['code']) ? 0 : $object['error']['code']), (string) $object['error']['message']);
|
||||
$this->assertGreaterThan(0, $object, 'ID return is no > 0');
|
||||
|
||||
return $idofcontactcreated;
|
||||
}
|
||||
|
||||
@@ -219,7 +219,7 @@ class RestAPIUserTest extends PHPUnit\Framework\TestCase
|
||||
$this->assertEquals($result['curl_error_no'], '');
|
||||
$object=json_decode($result['content'], true);
|
||||
$this->assertNotNull($object, "Parsing of json result must no be null");
|
||||
$this->assertEquals(500, $object['error']['code'], $object['error']['code'].' '.$object['error']['message']);
|
||||
$this->assertEquals(500, (empty($object['error']['code']) ? 0 : $object['error']['code']), (string) $object['error']['message']);
|
||||
|
||||
// create regular user
|
||||
unset($result);
|
||||
@@ -238,8 +238,8 @@ class RestAPIUserTest extends PHPUnit\Framework\TestCase
|
||||
$object = json_decode($result['content'], true); // If success content is just an id, if not an array
|
||||
|
||||
$this->assertNotNull($object, "Parsing of json result must no be null");
|
||||
$this->assertNotEquals(500, $object['error']['code'], $object['error']['code'].' '.$object['error']['message']);
|
||||
$this->assertGreaterThan(0, $object, $object['error']['code'].' '.$object['error']['message']);
|
||||
$this->assertNotEquals(500, (empty($object['error']['code']) ? 0 : $object['error']['code']), (string) $object['error']['message']);
|
||||
$this->assertGreaterThan(0, $object, 'ID returned is no > 0');
|
||||
|
||||
// attempt to create duplicated user
|
||||
print __METHOD__." Request POST url=".$url."\n";
|
||||
@@ -249,6 +249,6 @@ class RestAPIUserTest extends PHPUnit\Framework\TestCase
|
||||
$this->assertEquals($result['curl_error_no'], '');
|
||||
$object=json_decode($result['content'], true);
|
||||
$this->assertNotNull($object, "Parsing of json result must no be null");
|
||||
$this->assertEquals(500, $object['error']['code'], $object['error']['code'].' '.$object['error']['message']);
|
||||
$this->assertEquals(500, (empty($object['error']['code']) ? 0 : $object['error']['code']), (string) $object['error']['message']);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user