|
|
@@ -34,7 +34,7 @@ class DolibarrApiServiceTest extends TestCase
|
|
|
$dolibarrApiService
|
|
|
->expects(self::once())
|
|
|
->method('getJsonContent')
|
|
|
- ->with('thirdparties', [ 'limit' => '1', 'sqlfilters' => '(ef.2iopen_organization_id:=:' . $organizationId . ')'])
|
|
|
+ ->with('thirdparties', ['limit' => '1', 'sqlfilters' => '(ef.2iopen_organization_id:=:'.$organizationId.')'])
|
|
|
->willReturn([['id' => 1]]); // dummy non-empty data
|
|
|
|
|
|
$society = $dolibarrApiService->getSociety($organizationId);
|
|
|
@@ -45,7 +45,8 @@ class DolibarrApiServiceTest extends TestCase
|
|
|
/**
|
|
|
* @see DolibarrApiService::getSociety()
|
|
|
*/
|
|
|
- public function testGetSocietyMissing(): void {
|
|
|
+ public function testGetSocietyMissing(): void
|
|
|
+ {
|
|
|
$dolibarrApiService = $this->getMockBuilder(DolibarrApiService::class)
|
|
|
->setConstructorArgs([$this->client])
|
|
|
->setMethodsExcept(['getSociety'])
|
|
|
@@ -56,7 +57,7 @@ class DolibarrApiServiceTest extends TestCase
|
|
|
$dolibarrApiService
|
|
|
->expects(self::once())
|
|
|
->method('getJsonContent')
|
|
|
- ->with("thirdparties", [ "limit" => "1", "sqlfilters" => "(ef.2iopen_organization_id:=:" . $organizationId . ')'])
|
|
|
+ ->with('thirdparties', ['limit' => '1', 'sqlfilters' => '(ef.2iopen_organization_id:=:'.$organizationId.')'])
|
|
|
->willThrowException(new HttpException(404));
|
|
|
|
|
|
$society = $dolibarrApiService->getSociety($organizationId);
|
|
|
@@ -67,7 +68,8 @@ class DolibarrApiServiceTest extends TestCase
|
|
|
/**
|
|
|
* @see DolibarrApiService::getSociety()
|
|
|
*/
|
|
|
- public function testGetSocietyError(): void {
|
|
|
+ public function testGetSocietyError(): void
|
|
|
+ {
|
|
|
$dolibarrApiService = $this->getMockBuilder(DolibarrApiService::class)
|
|
|
->setConstructorArgs([$this->client])
|
|
|
->setMethodsExcept(['getSociety'])
|
|
|
@@ -78,7 +80,7 @@ class DolibarrApiServiceTest extends TestCase
|
|
|
$dolibarrApiService
|
|
|
->expects(self::once())
|
|
|
->method('getJsonContent')
|
|
|
- ->with("thirdparties", [ "limit" => "1", "sqlfilters" => "(ef.2iopen_organization_id:=:" . $organizationId . ')'])
|
|
|
+ ->with('thirdparties', ['limit' => '1', 'sqlfilters' => '(ef.2iopen_organization_id:=:'.$organizationId.')'])
|
|
|
->willThrowException(new HttpException(500));
|
|
|
|
|
|
$this->expectException(HttpException::class);
|
|
|
@@ -101,7 +103,7 @@ class DolibarrApiServiceTest extends TestCase
|
|
|
$dolibarrApiService
|
|
|
->expects(self::once())
|
|
|
->method('getJsonContent')
|
|
|
- ->with("contracts", ["limit" => "1", "sqlfilters" => "statut:=:1", "thirdparty_ids" => $socId])
|
|
|
+ ->with('contracts', ['limit' => '1', 'sqlfilters' => 'statut:=:1', 'thirdparty_ids' => $socId])
|
|
|
->willReturn([['id' => 1]]); // dummy non-empty data
|
|
|
|
|
|
$this->assertEquals(['id' => 1], $dolibarrApiService->getActiveContract($socId));
|
|
|
@@ -122,7 +124,7 @@ class DolibarrApiServiceTest extends TestCase
|
|
|
$dolibarrApiService
|
|
|
->expects(self::once())
|
|
|
->method('getJsonContent')
|
|
|
- ->with("contracts", ["limit" => "1", "sqlfilters" => "statut:=:1", "thirdparty_ids" => $socId])
|
|
|
+ ->with('contracts', ['limit' => '1', 'sqlfilters' => 'statut:=:1', 'thirdparty_ids' => $socId])
|
|
|
->willThrowException(new HttpException(404));
|
|
|
|
|
|
$this->assertEquals(null, $dolibarrApiService->getActiveContract($socId));
|
|
|
@@ -143,7 +145,7 @@ class DolibarrApiServiceTest extends TestCase
|
|
|
$dolibarrApiService
|
|
|
->expects(self::once())
|
|
|
->method('getJsonContent')
|
|
|
- ->with("contracts", ["limit" => "1", "sqlfilters" => "statut:=:1", "thirdparty_ids" => $socId])
|
|
|
+ ->with('contracts', ['limit' => '1', 'sqlfilters' => 'statut:=:1', 'thirdparty_ids' => $socId])
|
|
|
->willThrowException(new HttpException(500));
|
|
|
|
|
|
$this->expectException(HttpException::class);
|
|
|
@@ -166,7 +168,7 @@ class DolibarrApiServiceTest extends TestCase
|
|
|
$dolibarrApiService
|
|
|
->expects(self::once())
|
|
|
->method('getJsonContent')
|
|
|
- ->with("invoices", ["sortfield" => "datef", "sortorder" => "DESC", "limit" => 5, "sqlfilters" => "fk_soc:=:" . $socId])
|
|
|
+ ->with('invoices', ['sortfield' => 'datef', 'sortorder' => 'DESC', 'limit' => 5, 'sqlfilters' => 'fk_soc:=:'.$socId])
|
|
|
->willReturn([['id' => 10], ['id' => 20]]);
|
|
|
|
|
|
$this->assertEquals([['id' => 10], ['id' => 20]], $dolibarrApiService->getBills($socId));
|
|
|
@@ -187,7 +189,7 @@ class DolibarrApiServiceTest extends TestCase
|
|
|
$dolibarrApiService
|
|
|
->expects(self::once())
|
|
|
->method('getJsonContent')
|
|
|
- ->with("invoices", ["sortfield" => "datef", "sortorder" => "DESC", "limit" => 5, "sqlfilters" => "fk_soc:=:" . $socId])
|
|
|
+ ->with('invoices', ['sortfield' => 'datef', 'sortorder' => 'DESC', 'limit' => 5, 'sqlfilters' => 'fk_soc:=:'.$socId])
|
|
|
->willThrowException(new HttpException(404));
|
|
|
|
|
|
$this->assertEquals([], $dolibarrApiService->getBills($socId));
|
|
|
@@ -208,7 +210,7 @@ class DolibarrApiServiceTest extends TestCase
|
|
|
$dolibarrApiService
|
|
|
->expects(self::once())
|
|
|
->method('getJsonContent')
|
|
|
- ->with("invoices", ["sortfield" => "datef", "sortorder" => "DESC", "limit" => 5, "sqlfilters" => "fk_soc:=:" . $socId])
|
|
|
+ ->with('invoices', ['sortfield' => 'datef', 'sortorder' => 'DESC', 'limit' => 5, 'sqlfilters' => 'fk_soc:=:'.$socId])
|
|
|
->willThrowException(new HttpException(500));
|
|
|
|
|
|
$this->expectException(HttpException::class);
|
|
|
@@ -229,7 +231,7 @@ class DolibarrApiServiceTest extends TestCase
|
|
|
$dolibarrApiService
|
|
|
->expects(self::once())
|
|
|
->method('getJsonContent')
|
|
|
- ->with("thirdparties", ["limit" => "1000000", "sqlfilters" => "client:=:1"])
|
|
|
+ ->with('thirdparties', ['limit' => '1000000', 'sqlfilters' => 'client:=:1'])
|
|
|
->willReturn([['id' => 10], ['id' => 20]]);
|
|
|
|
|
|
$this->assertEquals([['id' => 10], ['id' => 20]], $dolibarrApiService->getAllClients());
|
|
|
@@ -315,7 +317,7 @@ class DolibarrApiServiceTest extends TestCase
|
|
|
$dolibarrApiService
|
|
|
->expects(self::once())
|
|
|
->method('getJsonContent')
|
|
|
- ->with("contacts?limit=1000&t.statut=1&thirdparty_ids=" . $socId . "&sqlfilters:=:(te.2iopen_person_id%3A%3E%3A0)")
|
|
|
+ ->with('contacts?limit=1000&t.statut=1&thirdparty_ids='.$socId.'&sqlfilters:=:(te.2iopen_person_id%3A%3E%3A0)')
|
|
|
->willReturn([['id' => 10], ['id' => 20]]);
|
|
|
|
|
|
$this->assertEquals([['id' => 10], ['id' => 20]], $dolibarrApiService->getActiveOpentalentContacts($socId));
|
|
|
@@ -336,7 +338,7 @@ class DolibarrApiServiceTest extends TestCase
|
|
|
$dolibarrApiService
|
|
|
->expects(self::once())
|
|
|
->method('getJsonContent')
|
|
|
- ->with("contacts?limit=1000&t.statut=1&thirdparty_ids=" . $socId . "&sqlfilters:=:(te.2iopen_person_id%3A%3E%3A0)")
|
|
|
+ ->with('contacts?limit=1000&t.statut=1&thirdparty_ids='.$socId.'&sqlfilters:=:(te.2iopen_person_id%3A%3E%3A0)')
|
|
|
->willThrowException(new HttpException(404));
|
|
|
|
|
|
$this->assertEquals([], $dolibarrApiService->getActiveOpentalentContacts($socId));
|
|
|
@@ -357,7 +359,7 @@ class DolibarrApiServiceTest extends TestCase
|
|
|
$dolibarrApiService
|
|
|
->expects(self::once())
|
|
|
->method('getJsonContent')
|
|
|
- ->with("contacts?limit=1000&t.statut=1&thirdparty_ids=" . $socId . "&sqlfilters:=:(te.2iopen_person_id%3A%3E%3A0)")
|
|
|
+ ->with('contacts?limit=1000&t.statut=1&thirdparty_ids='.$socId.'&sqlfilters:=:(te.2iopen_person_id%3A%3E%3A0)')
|
|
|
->willThrowException(new HttpException(500));
|
|
|
|
|
|
$this->expectException(HttpException::class);
|
|
|
@@ -380,7 +382,7 @@ class DolibarrApiServiceTest extends TestCase
|
|
|
$dolibarrApiService
|
|
|
->expects(self::once())
|
|
|
->method('getJsonContent')
|
|
|
- ->with("/thirdparties/1/categories")
|
|
|
+ ->with('/thirdparties/1/categories')
|
|
|
->willReturn([['id' => '10'], ['id' => '20']]);
|
|
|
|
|
|
$this->assertEquals(
|
|
|
@@ -404,7 +406,7 @@ class DolibarrApiServiceTest extends TestCase
|
|
|
$dolibarrApiService
|
|
|
->expects(self::once())
|
|
|
->method('getJsonContent')
|
|
|
- ->with("/thirdparties/1/categories")
|
|
|
+ ->with('/thirdparties/1/categories')
|
|
|
->willThrowException(new HttpException(404));
|
|
|
|
|
|
$this->assertEquals(
|
|
|
@@ -428,7 +430,7 @@ class DolibarrApiServiceTest extends TestCase
|
|
|
$dolibarrApiService
|
|
|
->expects(self::once())
|
|
|
->method('getJsonContent')
|
|
|
- ->with("/thirdparties/1/categories")
|
|
|
+ ->with('/thirdparties/1/categories')
|
|
|
->willThrowException(new HttpException(500));
|
|
|
|
|
|
$this->expectException(HttpException::class);
|