Ver Fonte

add unit tests for DolibarrService

Olivier Massot há 4 anos atrás
pai
commit
45749dce44

+ 98 - 0
tests/Service/Dolibarr/DolibarrServiceTest.php

@@ -0,0 +1,98 @@
+<?php
+
+namespace App\Tests\Service\Dolibarr;
+
+use App\Service\Dolibarr\DolibarrService;
+use PHPUnit\Framework\TestCase;
+use Symfony\Contracts\HttpClient\HttpClientInterface;
+use Symfony\Contracts\HttpClient\ResponseInterface;
+
+class DolibarrServiceTest extends TestCase
+{
+    private HttpClientInterface $client;
+    private DolibarrService $dolibarrService;
+
+    public function setUp(): void {
+        $this->client = $this->getMockBuilder(HttpClientInterface::class)
+            ->disableOriginalConstructor()
+            ->getMock();
+
+        $this->dolibarrService = new DolibarrService($this->client);
+    }
+
+    private function getContentFromFixture(string $filename) {
+        $filepath = dirname(__FILE__) . '/fixtures/' . $filename;
+        return file_get_contents($filepath);
+    }
+
+    /**
+     * @see DolibarrService::getSociety()
+     */
+    public function testGetSociety(): void {
+        $responseContent = $this->getContentFromFixture('thirdparty.json');
+
+        $response = $this->getMockBuilder(ResponseInterface::class)
+            ->disableOriginalConstructor()
+            ->getMock();
+        $response->method('getContent')->willReturn($responseContent);
+
+        $this->client
+            ->expects($this->once())
+            ->method('request')
+            ->with("GET", "thirdparties?sqlfilters=ref_int%3D1")
+            ->willReturn($response);
+
+        $data = $this->dolibarrService->getSociety(1);
+
+        $this->assertEquals(
+            $data['id'],
+            1726
+        );
+    }
+
+    /**
+     * @see DolibarrService::getActiveContract()
+     */
+    public function testGetActiveContract(): void {
+        $responseContent = $this->getContentFromFixture('contract.json');
+
+        $response = $this->getMockBuilder(ResponseInterface::class)
+            ->disableOriginalConstructor()
+            ->getMock();
+        $response->method('getContent')->willReturn($responseContent);
+
+        $this->client
+            ->expects($this->once())
+            ->method('request')
+            ->with("GET", "contracts?limit=1&sqlfilters=statut%3D1&thirdparty_ids%3D1")
+            ->willReturn($response);
+
+        $this->assertEquals(
+            $this->dolibarrService->getActiveContract(1)['socid'],
+            43
+        );
+    }
+
+    /**
+     * @see DolibarrService::getBills()
+     */
+    public function testGetBills(): void {
+        $responseContent = $this->getContentFromFixture('bills.json');
+
+        $response = $this->getMockBuilder(ResponseInterface::class)
+            ->disableOriginalConstructor()
+            ->getMock();
+        $response->method('getContent')->willReturn($responseContent);
+
+        $this->client
+            ->expects($this->once())
+            ->method('request')
+            ->with("GET", "invoices?sortfield=datef&sortorder=DESC&limit=5&sqlfilters=fk_soc%3D1")
+            ->willReturn($response);
+
+        $this->assertEquals(
+            $this->dolibarrService->getBills(1)[2]['socid'],
+            284
+        );
+    }
+}

+ 542 - 0
tests/Service/Dolibarr/fixtures/bills.json

@@ -0,0 +1,542 @@
+[
+  {
+    "socid": "284",
+    "fk_user_author": null,
+    "fk_user_valid": null,
+    "date": 1624831200,
+    "datem": 1626091849,
+    "ref_client": null,
+    "type": "2",
+    "remise_absolue": null,
+    "remise_percent": null,
+    "total_ht": "-731.00000000",
+    "total_tva": "-146.20000000",
+    "total_localtax1": "0.00000000",
+    "total_localtax2": "0.00000000",
+    "total_ttc": "-877.20000000",
+    "revenuestamp": "0.00000000",
+    "close_code": null,
+    "close_note": null,
+    "paye": "1",
+    "module_source": null,
+    "pos_source": null,
+    "fk_fac_rec_source": null,
+    "fk_facture_source": "256",
+    "linked_objects": [],
+    "date_lim_reglement": 1624831200,
+    "cond_reglement_code": null,
+    "mode_reglement_code": "VIR",
+    "fk_bank": null,
+    "products": [],
+    "lines": [
+      {
+        "fk_facture": "310",
+        "fk_parent_line": null,
+        "label": null,
+        "desc": "<p>Logiciel de gestion et de communication pour les &eacute;tablissements d&#39;enseignement artistique comprend :</p>\r\n\r\n<ul>\r\n\t<li>3 comptes administratifs</li>\r\n\t<li>comptes utilisateurs (&eacute;l&egrave;ves, familles et professeurs)</li>\r\n\t<li>site internet complet</li>\r\n</ul>\r\n<br />\r\n<em><strong>Conditions r&eacute;serv&eacute;es aux adh&eacute;rents CMF. </strong>.En cas de non renouvellement de votre adh&eacute;sion, vous basculerez sur les conditions publiques.</em>\r\n\r\n<p>&nbsp;</p>",
+        "localtax1_type": "0",
+        "localtax2_type": "0",
+        "fk_remise_except": null,
+        "rang": "0",
+        "fk_fournprice": null,
+        "pa_ht": "731.00000000",
+        "marge_tx": -0,
+        "marque_tx": 0,
+        "special_code": "0",
+        "origin": null,
+        "origin_id": null,
+        "fk_code_ventilation": 0,
+        "date_start": 1624053600,
+        "date_end": 1655503200,
+        "ref": "ABO_SCH_PRE_200-399_CMF",
+        "product_ref": "ABO_SCH_PRE_200-399_CMF",
+        "libelle": "Abonnement Opentalent School premium Tranche  200-399 Adhérent CMF",
+        "product_label": "Abonnement Opentalent School premium Tranche  200-399 Adhérent CMF",
+        "product_desc": "<p>Logiciel de gestion et de communication pour les &eacute;tablissements d&#39;enseignement artistique comprend :</p>\r\n\r\n<ul>\r\n\t<li>3 comptes administratifs</li>\r\n\t<li>comptes utilisateurs (&eacute;l&egrave;ves, familles et professeurs)</li>\r\n\t<li>site internet complet</li>\r\n</ul>\r\n<br />\r\n<em><strong>Conditions r&eacute;serv&eacute;es aux adh&eacute;rents CMF. </strong>.En cas de non renouvellement de votre adh&eacute;sion, vous basculerez sur les conditions publiques.</em>\r\n\r\n<p>&nbsp;</p>",
+        "situation_percent": "100",
+        "fk_prev_id": null,
+        "multicurrency_subprice": "-731.00000000",
+        "multicurrency_total_ht": "-731.00000000",
+        "multicurrency_total_tva": "-146.20000000",
+        "multicurrency_total_ttc": "-877.20000000",
+        "qty": "1",
+        "subprice": "-731.00000000",
+        "product_type": "1",
+        "fk_product": "327",
+        "vat_src_code": "",
+        "tva_tx": "20.000",
+        "localtax1_tx": "0.000",
+        "localtax2_tx": "0.000",
+        "remise_percent": "0",
+        "total_ht": "-731.00000000",
+        "total_tva": "-146.20000000",
+        "total_localtax1": "0.00000000",
+        "total_localtax2": "0.00000000",
+        "total_ttc": "-877.20000000",
+        "info_bits": "0",
+        "id": "1240",
+        "rowid": "1240",
+        "fk_unit": null,
+        "import_key": null,
+        "array_options": {
+          "options_show_total_ht": null,
+          "options_show_reduc": null
+        },
+        "linkedObjectsIds": null,
+        "canvas": null,
+        "ref_ext": null,
+        "statut": null,
+        "state": null,
+        "state_id": null,
+        "state_code": null,
+        "transport_mode_id": null,
+        "last_main_doc": null,
+        "fk_account": null,
+        "lines": null,
+        "date_creation": null,
+        "date_validation": null,
+        "date_modification": null,
+        "description": "<p>Logiciel de gestion et de communication pour les &eacute;tablissements d&#39;enseignement artistique comprend :</p>\r\n\r\n<ul>\r\n\t<li>3 comptes administratifs</li>\r\n\t<li>comptes utilisateurs (&eacute;l&egrave;ves, familles et professeurs)</li>\r\n\t<li>site internet complet</li>\r\n</ul>\r\n<br />\r\n<em><strong>Conditions r&eacute;serv&eacute;es aux adh&eacute;rents CMF. </strong>.En cas de non renouvellement de votre adh&eacute;sion, vous basculerez sur les conditions publiques.</em>\r\n\r\n<p>&nbsp;</p>",
+        "fk_product_type": "1",
+        "code_ventilation": "100105976",
+        "fk_accounting_account": "100105976"
+      }
+    ],
+    "line": null,
+    "extraparams": [],
+    "specimen": null,
+    "fac_rec": null,
+    "fk_multicurrency": "0",
+    "multicurrency_code": "EUR",
+    "multicurrency_tx": "1.00000000",
+    "multicurrency_total_ht": "-731.00000000",
+    "multicurrency_total_tva": "-146.20000000",
+    "multicurrency_total_ttc": "-877.20000000",
+    "situation_cycle_ref": null,
+    "situation_counter": null,
+    "situation_final": "0",
+    "tab_previous_situation_invoice": [],
+    "tab_next_situation_invoice": [],
+    "id": "310",
+    "import_key": null,
+    "array_options": {
+      "options_rfltr_model_id": null,
+      "options_2iopen_origvente": "2",
+      "options_logicielfact": "2",
+      "options_versionfact": "2",
+      "options_ec_beg_bill_period_date": "",
+      "options_ec_end_bill_period_date": ""
+    },
+    "linkedObjectsIds": null,
+    "canvas": null,
+    "fk_project": null,
+    "contact": null,
+    "contact_id": null,
+    "thirdparty": null,
+    "user": null,
+    "origin": null,
+    "origin_id": null,
+    "ref": "AV2106-02992",
+    "ref_ext": null,
+    "statut": "2",
+    "country": null,
+    "country_id": null,
+    "country_code": null,
+    "state": null,
+    "state_id": null,
+    "state_code": null,
+    "mode_reglement_id": "2",
+    "cond_reglement_id": "0",
+    "transport_mode_id": null,
+    "cond_reglement": null,
+    "shipping_method_id": null,
+    "modelpdf": "InfraSPlus_F",
+    "last_main_doc": "facture/AV2106-02992/AV2106-02992.pdf",
+    "fk_account": "1",
+    "note_public": "Annule la facture FA2105-03135 suite geste commerciale exceptionnel de 10% sur le montant de l'abonnement au logiciel Opentalent School Premium",
+    "note_private": null,
+    "fk_incoterms": "0",
+    "libelle_incoterms": null,
+    "location_incoterms": "",
+    "name": null,
+    "lastname": null,
+    "firstname": null,
+    "civility_id": null,
+    "date_creation": 1624893979,
+    "date_validation": 1624831200,
+    "date_modification": 1626091849,
+    "entity": "1",
+    "date_pointoftax": "",
+    "mode_reglement": "Virement",
+    "cond_reglement_doc": null,
+    "user_author": "5",
+    "user_valid": "5",
+    "totalpaid": null,
+    "totalcreditnotes": null,
+    "totaldeposits": null,
+    "remaintopay": "-877.20",
+    "contacts_ids": [
+      "29845"
+    ]
+  },
+  {
+    "socid": "284",
+    "fk_user_author": null,
+    "fk_user_valid": null,
+    "date": 1624831200,
+    "datem": 1625552613,
+    "ref_client": null,
+    "type": "0",
+    "remise_absolue": null,
+    "remise_percent": null,
+    "total_ht": "657.90000000",
+    "total_tva": "131.58000000",
+    "total_localtax1": "0.00000000",
+    "total_localtax2": "0.00000000",
+    "total_ttc": "789.48000000",
+    "revenuestamp": "0.00000000",
+    "close_code": null,
+    "close_note": null,
+    "paye": "1",
+    "module_source": null,
+    "pos_source": null,
+    "fk_fac_rec_source": null,
+    "fk_facture_source": null,
+    "linked_objects": [],
+    "date_lim_reglement": 1624917600,
+    "cond_reglement_code": "RECEP",
+    "mode_reglement_code": "VIR",
+    "fk_bank": null,
+    "products": [],
+    "lines": [
+      {
+        "fk_facture": "311",
+        "fk_parent_line": null,
+        "label": null,
+        "desc": "<p>Logiciel de gestion et de communication pour les &eacute;tablissements d&#39;enseignement artistique comprend :</p>\r\n\r\n<ul>\r\n\t<li>3 comptes administratifs</li>\r\n\t<li>comptes utilisateurs (&eacute;l&egrave;ves, familles et professeurs)</li>\r\n\t<li>site internet complet</li>\r\n</ul>\r\n<br />\r\n<em><strong>Conditions r&eacute;serv&eacute;es aux adh&eacute;rents CMF. </strong>.En cas de non renouvellement de votre adh&eacute;sion, vous basculerez sur les conditions publiques.</em>\r\n\r\n<p><span style=\"color:#e74c3c\"><strong>Geste commercial exceptionnel de 10 %</strong></span></p>",
+        "localtax1_type": "0",
+        "localtax2_type": "0",
+        "fk_remise_except": null,
+        "rang": "0",
+        "fk_fournprice": null,
+        "pa_ht": "731.00000000",
+        "marge_tx": -10.000000000000002,
+        "marque_tx": -11.111111111111114,
+        "special_code": "0",
+        "origin": null,
+        "origin_id": null,
+        "fk_code_ventilation": 0,
+        "date_start": 1624053600,
+        "date_end": 1655503200,
+        "ref": "ABO_SCH_PRE_200-399_CMF",
+        "product_ref": "ABO_SCH_PRE_200-399_CMF",
+        "libelle": "Abonnement Opentalent School premium Tranche  200-399 Adhérent CMF",
+        "product_label": "Abonnement Opentalent School premium Tranche  200-399 Adhérent CMF",
+        "product_desc": "<p>Logiciel de gestion et de communication pour les &eacute;tablissements d&#39;enseignement artistique comprend :</p>\r\n\r\n<ul>\r\n\t<li>3 comptes administratifs</li>\r\n\t<li>comptes utilisateurs (&eacute;l&egrave;ves, familles et professeurs)</li>\r\n\t<li>site internet complet</li>\r\n</ul>\r\n<br />\r\n<em><strong>Conditions r&eacute;serv&eacute;es aux adh&eacute;rents CMF. </strong>.En cas de non renouvellement de votre adh&eacute;sion, vous basculerez sur les conditions publiques.</em>\r\n\r\n<p>&nbsp;</p>",
+        "situation_percent": "100",
+        "fk_prev_id": null,
+        "multicurrency_subprice": "731.00000000",
+        "multicurrency_total_ht": "657.90000000",
+        "multicurrency_total_tva": "131.58000000",
+        "multicurrency_total_ttc": "789.48000000",
+        "qty": "1",
+        "subprice": "731.00000000",
+        "product_type": "1",
+        "fk_product": "327",
+        "vat_src_code": "",
+        "tva_tx": "20.000",
+        "localtax1_tx": "0.000",
+        "localtax2_tx": "0.000",
+        "remise_percent": "10",
+        "total_ht": "657.90000000",
+        "total_tva": "131.58000000",
+        "total_localtax1": "0.00000000",
+        "total_localtax2": "0.00000000",
+        "total_ttc": "789.48000000",
+        "info_bits": "0",
+        "id": "1241",
+        "rowid": "1241",
+        "fk_unit": null,
+        "import_key": null,
+        "array_options": {
+          "options_show_total_ht": null,
+          "options_show_reduc": null
+        },
+        "linkedObjectsIds": null,
+        "canvas": null,
+        "ref_ext": null,
+        "statut": null,
+        "state": null,
+        "state_id": null,
+        "state_code": null,
+        "transport_mode_id": null,
+        "last_main_doc": null,
+        "fk_account": null,
+        "lines": null,
+        "date_creation": null,
+        "date_validation": null,
+        "date_modification": null,
+        "description": "<p>Logiciel de gestion et de communication pour les &eacute;tablissements d&#39;enseignement artistique comprend :</p>\r\n\r\n<ul>\r\n\t<li>3 comptes administratifs</li>\r\n\t<li>comptes utilisateurs (&eacute;l&egrave;ves, familles et professeurs)</li>\r\n\t<li>site internet complet</li>\r\n</ul>\r\n<br />\r\n<em><strong>Conditions r&eacute;serv&eacute;es aux adh&eacute;rents CMF. </strong>.En cas de non renouvellement de votre adh&eacute;sion, vous basculerez sur les conditions publiques.</em>\r\n\r\n<p><span style=\"color:#e74c3c\"><strong>Geste commercial exceptionnel de 10 %</strong></span></p>",
+        "fk_product_type": "1",
+        "code_ventilation": "100105976",
+        "fk_accounting_account": "100105976"
+      }
+    ],
+    "line": null,
+    "extraparams": [],
+    "specimen": null,
+    "fac_rec": null,
+    "fk_multicurrency": "0",
+    "multicurrency_code": "EUR",
+    "multicurrency_tx": "1.00000000",
+    "multicurrency_total_ht": "657.90000000",
+    "multicurrency_total_tva": "131.58000000",
+    "multicurrency_total_ttc": "789.48000000",
+    "situation_cycle_ref": null,
+    "situation_counter": null,
+    "situation_final": "0",
+    "tab_previous_situation_invoice": [],
+    "tab_next_situation_invoice": [],
+    "id": "311",
+    "import_key": null,
+    "array_options": {
+      "options_rfltr_model_id": null,
+      "options_2iopen_origvente": "2",
+      "options_logicielfact": "2",
+      "options_versionfact": "2",
+      "options_ec_beg_bill_period_date": 1624053600,
+      "options_ec_end_bill_period_date": 1655503200
+    },
+    "linkedObjectsIds": null,
+    "canvas": null,
+    "fk_project": null,
+    "contact": null,
+    "contact_id": null,
+    "thirdparty": null,
+    "user": null,
+    "origin": null,
+    "origin_id": null,
+    "ref": "FA2106-03183",
+    "ref_ext": null,
+    "statut": "2",
+    "country": null,
+    "country_id": null,
+    "country_code": null,
+    "state": null,
+    "state_id": null,
+    "state_code": null,
+    "mode_reglement_id": "2",
+    "cond_reglement_id": "1",
+    "transport_mode_id": null,
+    "cond_reglement": "Due upon receipt",
+    "shipping_method_id": null,
+    "modelpdf": "InfraSPlus_F",
+    "last_main_doc": "facture/FA2106-03183/FA2106-03183.pdf",
+    "fk_account": "1",
+    "note_public": null,
+    "note_private": null,
+    "fk_incoterms": "0",
+    "libelle_incoterms": null,
+    "location_incoterms": "",
+    "name": null,
+    "lastname": null,
+    "firstname": null,
+    "civility_id": null,
+    "date_creation": 1624895968,
+    "date_validation": 1624831200,
+    "date_modification": 1625552613,
+    "entity": "1",
+    "date_pointoftax": "",
+    "mode_reglement": "Virement",
+    "cond_reglement_doc": "Due upon receipt",
+    "user_author": "5",
+    "user_valid": "5",
+    "totalpaid": "789.48000000",
+    "totalcreditnotes": null,
+    "totaldeposits": null,
+    "remaintopay": "0",
+    "contacts_ids": [
+      "29845"
+    ]
+  },
+  {
+    "socid": "284",
+    "fk_user_author": null,
+    "fk_user_valid": null,
+    "date": 1621980000,
+    "datem": 1626091889,
+    "ref_client": null,
+    "type": "0",
+    "remise_absolue": null,
+    "remise_percent": null,
+    "total_ht": "731.00000000",
+    "total_tva": "146.20000000",
+    "total_localtax1": "0.00000000",
+    "total_localtax2": "0.00000000",
+    "total_ttc": "877.20000000",
+    "revenuestamp": "0.00000000",
+    "close_code": null,
+    "close_note": null,
+    "paye": "1",
+    "module_source": null,
+    "pos_source": null,
+    "fk_fac_rec_source": null,
+    "fk_facture_source": null,
+    "linked_objects": [],
+    "date_lim_reglement": 1622066400,
+    "cond_reglement_code": "RECEP",
+    "mode_reglement_code": "VIR",
+    "fk_bank": null,
+    "products": [],
+    "lines": [
+      {
+        "fk_facture": "256",
+        "fk_parent_line": null,
+        "label": null,
+        "desc": "<p>Logiciel de gestion et de communication pour les &eacute;tablissements d&#39;enseignement artistique comprend :</p>\r\n\r\n<ul>\r\n\t<li>3 comptes administratifs</li>\r\n\t<li>comptes utilisateurs (&eacute;l&egrave;ves, familles et professeurs)</li>\r\n\t<li>site internet complet</li>\r\n</ul>\r\n<br />\r\n<em><strong>Conditions r&eacute;serv&eacute;es aux adh&eacute;rents CMF. </strong>.En cas de non renouvellement de votre adh&eacute;sion, vous basculerez sur les conditions publiques.</em>\r\n\r\n<p>&nbsp;</p>",
+        "localtax1_type": "0",
+        "localtax2_type": "0",
+        "fk_remise_except": null,
+        "rang": "0",
+        "fk_fournprice": null,
+        "pa_ht": "731.00000000",
+        "marge_tx": 0,
+        "marque_tx": 0,
+        "special_code": "0",
+        "origin": null,
+        "origin_id": null,
+        "fk_code_ventilation": 0,
+        "date_start": 1624053600,
+        "date_end": 1655503200,
+        "ref": "ABO_SCH_PRE_200-399_CMF",
+        "product_ref": "ABO_SCH_PRE_200-399_CMF",
+        "libelle": "Abonnement Opentalent School premium Tranche  200-399 Adhérent CMF",
+        "product_label": "Abonnement Opentalent School premium Tranche  200-399 Adhérent CMF",
+        "product_desc": "<p>Logiciel de gestion et de communication pour les &eacute;tablissements d&#39;enseignement artistique comprend :</p>\r\n\r\n<ul>\r\n\t<li>3 comptes administratifs</li>\r\n\t<li>comptes utilisateurs (&eacute;l&egrave;ves, familles et professeurs)</li>\r\n\t<li>site internet complet</li>\r\n</ul>\r\n<br />\r\n<em><strong>Conditions r&eacute;serv&eacute;es aux adh&eacute;rents CMF. </strong>.En cas de non renouvellement de votre adh&eacute;sion, vous basculerez sur les conditions publiques.</em>\r\n\r\n<p>&nbsp;</p>",
+        "situation_percent": "100",
+        "fk_prev_id": null,
+        "multicurrency_subprice": "731.00000000",
+        "multicurrency_total_ht": "731.00000000",
+        "multicurrency_total_tva": "146.20000000",
+        "multicurrency_total_ttc": "877.20000000",
+        "qty": "1",
+        "subprice": "731.00000000",
+        "product_type": "1",
+        "fk_product": "327",
+        "vat_src_code": "",
+        "tva_tx": "20.000",
+        "localtax1_tx": "0.000",
+        "localtax2_tx": "0.000",
+        "remise_percent": "0",
+        "total_ht": "731.00000000",
+        "total_tva": "146.20000000",
+        "total_localtax1": "0.00000000",
+        "total_localtax2": "0.00000000",
+        "total_ttc": "877.20000000",
+        "info_bits": "0",
+        "id": "952",
+        "rowid": "952",
+        "fk_unit": null,
+        "import_key": null,
+        "array_options": {
+          "options_show_total_ht": null,
+          "options_show_reduc": null
+        },
+        "linkedObjectsIds": null,
+        "canvas": null,
+        "ref_ext": null,
+        "statut": null,
+        "state": null,
+        "state_id": null,
+        "state_code": null,
+        "transport_mode_id": null,
+        "last_main_doc": null,
+        "fk_account": null,
+        "lines": null,
+        "date_creation": null,
+        "date_validation": null,
+        "date_modification": null,
+        "description": "<p>Logiciel de gestion et de communication pour les &eacute;tablissements d&#39;enseignement artistique comprend :</p>\r\n\r\n<ul>\r\n\t<li>3 comptes administratifs</li>\r\n\t<li>comptes utilisateurs (&eacute;l&egrave;ves, familles et professeurs)</li>\r\n\t<li>site internet complet</li>\r\n</ul>\r\n<br />\r\n<em><strong>Conditions r&eacute;serv&eacute;es aux adh&eacute;rents CMF. </strong>.En cas de non renouvellement de votre adh&eacute;sion, vous basculerez sur les conditions publiques.</em>\r\n\r\n<p>&nbsp;</p>",
+        "fk_product_type": "1",
+        "code_ventilation": "100105976",
+        "fk_accounting_account": "100105976"
+      }
+    ],
+    "line": null,
+    "extraparams": [],
+    "specimen": null,
+    "fac_rec": null,
+    "fk_multicurrency": "0",
+    "multicurrency_code": "EUR",
+    "multicurrency_tx": "1.00000000",
+    "multicurrency_total_ht": "731.00000000",
+    "multicurrency_total_tva": "146.20000000",
+    "multicurrency_total_ttc": "877.20000000",
+    "situation_cycle_ref": null,
+    "situation_counter": null,
+    "situation_final": "0",
+    "tab_previous_situation_invoice": [],
+    "tab_next_situation_invoice": [],
+    "id": "256",
+    "import_key": null,
+    "array_options": {
+      "options_rfltr_model_id": null,
+      "options_2iopen_origvente": "2",
+      "options_logicielfact": "2",
+      "options_versionfact": "2",
+      "options_ec_beg_bill_period_date": 1624053600,
+      "options_ec_end_bill_period_date": 1655503200
+    },
+    "linkedObjectsIds": null,
+    "canvas": null,
+    "fk_project": null,
+    "contact": null,
+    "contact_id": null,
+    "thirdparty": null,
+    "user": null,
+    "origin": null,
+    "origin_id": null,
+    "ref": "FA2105-03135",
+    "ref_ext": null,
+    "statut": "2",
+    "country": null,
+    "country_id": null,
+    "country_code": null,
+    "state": null,
+    "state_id": null,
+    "state_code": null,
+    "mode_reglement_id": "2",
+    "cond_reglement_id": "1",
+    "transport_mode_id": null,
+    "cond_reglement": "Due upon receipt",
+    "shipping_method_id": null,
+    "modelpdf": "InfraSPlus_F",
+    "last_main_doc": "facture/FA2105-03135/FA2105-03135.pdf",
+    "fk_account": "1",
+    "note_public": null,
+    "note_private": null,
+    "fk_incoterms": "0",
+    "libelle_incoterms": null,
+    "location_incoterms": "",
+    "name": null,
+    "lastname": null,
+    "firstname": null,
+    "civility_id": null,
+    "date_creation": 1622017153,
+    "date_validation": 1621980000,
+    "date_modification": 1626091889,
+    "entity": "1",
+    "date_pointoftax": "",
+    "mode_reglement": "Virement",
+    "cond_reglement_doc": "Due upon receipt",
+    "user_author": "5",
+    "user_valid": "5",
+    "totalpaid": null,
+    "totalcreditnotes": "877.20000000",
+    "totaldeposits": null,
+    "remaintopay": "0",
+    "contacts_ids": [
+      "29845"
+    ]
+  }
+]

+ 187 - 0
tests/Service/Dolibarr/fixtures/contract.json

@@ -0,0 +1,187 @@
+[
+  {
+    "ref_customer": null,
+    "ref_supplier": null,
+    "entity": "1",
+    "socid": "43",
+    "societe": null,
+    "statut": "1",
+    "product": null,
+    "fk_user_author": null,
+    "user_author_id": "1",
+    "user_creation": null,
+    "user_cloture": null,
+    "date_creation": 1280786400,
+    "date_modification": null,
+    "date_validation": null,
+    "date_contrat": 1280786400,
+    "commercial_signature_id": "5",
+    "commercial_suivi_id": "5",
+    "fk_projet": null,
+    "extraparams": [],
+    "lines": [
+      {
+        "id": "4",
+        "ref": "ABO_ART_PRE_CMF",
+        "tms": null,
+        "fk_contrat": "2",
+        "fk_product": "282",
+        "statut": "4",
+        "type": null,
+        "label": null,
+        "libelle": null,
+        "description": "<p>Logiciel de gestion et de communication en ligne pour les structures culturelles de type Chorale, Orchestre, Compagnie (cirque, danse, de rue, théâtre,etc...).\n<br/>Inclus 150 comptes internet pour les membres et un site internet personnalisable.\n<br/>Conditions réservées aux adhérents CMF. En cas de non renouvellement de votre adhésion, vous basculerez sur les conditions publiques.</p>",
+        "product_type": "1",
+        "product_ref": "ABO_ART_PRE_CMF",
+        "product_label": "Abonnement Opentalent Artist premium CMF",
+        "date_commande": null,
+        "date_start": 1280786400,
+        "date_start_real": 1280786400,
+        "date_end": 1659477600,
+        "date_end_real": "",
+        "tva_tx": "20.000",
+        "localtax1_tx": "0.000",
+        "localtax2_tx": "0.000",
+        "localtax1_type": null,
+        "localtax2_type": null,
+        "qty": "1",
+        "remise_percent": "0",
+        "remise": null,
+        "fk_remise_except": null,
+        "subprice": "63.33000000",
+        "price": "63.33",
+        "price_ht": "63.33",
+        "total_ht": "63.33000000",
+        "total_tva": "12.67000000",
+        "total_localtax1": "0.00000000",
+        "total_localtax2": "0.00000000",
+        "total_ttc": "76.00000000",
+        "fk_fournprice": null,
+        "pa_ht": "63.33000000",
+        "info_bits": "0",
+        "fk_user_author": "1",
+        "fk_user_ouverture": "1",
+        "fk_user_cloture": null,
+        "commentaire": null,
+        "rowid": null,
+        "fk_unit": null,
+        "import_key": null,
+        "array_options": {
+          "options_2iopen_vers_fact": null,
+          "options_2iopen_log_fact": null,
+          "options_ec_type_line": "8"
+        },
+        "linkedObjectsIds": null,
+        "canvas": null,
+        "origin": null,
+        "origin_id": null,
+        "ref_ext": null,
+        "state": null,
+        "state_id": null,
+        "state_code": null,
+        "barcode_type": null,
+        "barcode_type_code": null,
+        "barcode_type_label": null,
+        "barcode_type_coder": null,
+        "transport_mode_id": null,
+        "last_main_doc": null,
+        "fk_account": null,
+        "note": null,
+        "lines": null,
+        "date_creation": null,
+        "date_validation": null,
+        "date_modification": null,
+        "desc": "<p>Logiciel de gestion et de communication en ligne pour les structures culturelles de type Chorale, Orchestre, Compagnie (cirque, danse, de rue, théâtre,etc...).\n<br/>Inclus 150 comptes internet pour les membres et un site internet personnalisable.\n<br/>Conditions réservées aux adhérents CMF. En cas de non renouvellement de votre adhésion, vous basculerez sur les conditions publiques.</p>",
+        "vat_src_code": "",
+        "product_desc": "<p>Logiciel de gestion et de communication en ligne pour les structures culturelles de type Chorale, Orchestre, Compagnie (cirque, danse, de rue, th&eacute;&acirc;tre,etc...).<br />\r\nInclus 150 comptes internet pour les membres et un site internet personnalisable.<br />\r\nConditions r&eacute;serv&eacute;es aux adh&eacute;rents CMF. En cas de non renouvellement de votre adh&eacute;sion, vous basculerez sur les conditions publiques.</p>"
+      }
+    ],
+    "id": "2",
+    "import_key": null,
+    "array_options": {
+      "options_rfltr_model_id": null,
+      "options_2iopen_origvente": "2",
+      "options_logicielfact": "1",
+      "options_versionfact": "2",
+      "options_ec_initial_amount": "63.33000000",
+      "options_ec_amount": "63.33000000",
+      "options_ec_initial_value_installation": null,
+      "options_ec_current_value_installation": "0.00000000",
+      "options_ec_signature_date": "",
+      "options_ec_effective_date": 1280786400,
+      "options_ec_duration_months": "12",
+      "options_ec_tacit_renewal": "1",
+      "options_ec_termination_period_months": "2",
+      "options_ec_des_term_date": "",
+      "options_ec_eff_term_date": "",
+      "options_ec_billing_due": "1",
+      "options_ec_billing_frequency": "4",
+      "options_ec_billing_begin_period": "1",
+      "options_ec_payment_condition": "1",
+      "options_ec_payment_mode": "2",
+      "options_ec_account": "1",
+      "options_ec_revaluation_index": "2",
+      "options_ec_enable_to_revaluation_date": 1609455600,
+      "options_ec_revaluation_date": "1",
+      "options_ec_month_for_new_revaluation_index": "11",
+      "options_ec_initial_revaluation_index_used": "1",
+      "options_ec_last_revaluation_index_used": "14",
+      "options_ec_revaluation_calculation_base": "2",
+      "options_ec_fixed_amount_not_revaluable": null,
+      "options_ec_unauthorized_deflation": "1",
+      "options_ec_amount_round_rule": null
+    },
+    "linkedObjectsIds": null,
+    "canvas": null,
+    "fk_project": null,
+    "contact": null,
+    "contact_id": null,
+    "thirdparty": null,
+    "user": null,
+    "origin": null,
+    "origin_id": null,
+    "ref": "0000037-C1_1",
+    "ref_ext": null,
+    "country": null,
+    "country_id": null,
+    "country_code": null,
+    "state": null,
+    "state_id": null,
+    "state_code": null,
+    "barcode_type": null,
+    "barcode_type_code": null,
+    "barcode_type_label": null,
+    "barcode_type_coder": null,
+    "mode_reglement_id": null,
+    "cond_reglement_id": null,
+    "transport_mode_id": null,
+    "cond_reglement": null,
+    "shipping_method_id": null,
+    "modelpdf": null,
+    "last_main_doc": null,
+    "fk_account": null,
+    "note_public": null,
+    "note_private": null,
+    "note": null,
+    "total_ht": "63.33",
+    "total_tva": null,
+    "total_localtax1": null,
+    "total_localtax2": null,
+    "total_ttc": "76",
+    "fk_incoterms": null,
+    "libelle_incoterms": null,
+    "location_incoterms": null,
+    "name": null,
+    "lastname": null,
+    "firstname": null,
+    "mise_en_service": 1280786400,
+    "fin_validite": 1627941600,
+    "fk_soc": "43",
+    "nbofserviceswait": 0,
+    "nbofservicesopened": 1,
+    "nbofservicesexpired": 0,
+    "nbofservicesclosed": 0,
+    "nbofservices": 1,
+    "total_vat": "12.67"
+  }
+]

+ 132 - 0
tests/Service/Dolibarr/fixtures/thirdparty.json

@@ -0,0 +1,132 @@
+[
+  {
+    "entity": "1",
+    "name": "Etablissement d'Enseignement Artistique",
+    "name_alias": null,
+    "address": "\n217, rue Raoul Follereau\n",
+    "zip": "74300",
+    "town": "CLUSES",
+    "status": "1",
+    "state_id": "81",
+    "state_code": "74",
+    "state": "Haute-Savoie",
+    "phone": "+33678403010",
+    "fax": null,
+    "email": null,
+    "skype": null,
+    "twitter": null,
+    "facebook": null,
+    "linkedin": null,
+    "url": null,
+    "barcode": null,
+    "idprof1": null,
+    "idprof2": null,
+    "idprof3": null,
+    "idprof4": null,
+    "idprof5": null,
+    "idprof6": null,
+    "tva_assuj": "1",
+    "tva_intra": null,
+    "localtax1_assuj": "0",
+    "localtax1_value": null,
+    "localtax2_assuj": "0",
+    "localtax2_value": null,
+    "managers": null,
+    "capital": null,
+    "typent_id": "0",
+    "typent_code": "TE_UNKNOWN",
+    "effectif": "",
+    "effectif_id": "0",
+    "forme_juridique_code": "812",
+    "forme_juridique": null,
+    "remise_percent": "",
+    "remise_supplier_percent": "0",
+    "mode_reglement_supplier_id": null,
+    "cond_reglement_supplier_id": null,
+    "transport_mode_supplier_id": null,
+    "fk_prospectlevel": null,
+    "date_modification": 1632728888,
+    "user_modification": null,
+    "date_creation": "",
+    "user_creation": null,
+    "specimen": null,
+    "client": "2",
+    "prospect": 0,
+    "fournisseur": "0",
+    "code_client": "001855",
+    "code_fournisseur": null,
+    "code_compta": "0001855",
+    "code_compta_client": null,
+    "code_compta_fournisseur": null,
+    "note_private": null,
+    "note_public": null,
+    "stcomm_id": "0",
+    "statut_commercial": "Never contacted",
+    "stcomm_picto": null,
+    "price_level": null,
+    "outstanding_limit": null,
+    "order_min_amount": null,
+    "supplier_order_min_amount": null,
+    "parent": null,
+    "default_lang": null,
+    "ref": "1726",
+    "ref_ext": null,
+    "import_key": "crm",
+    "webservices_url": null,
+    "webservices_key": null,
+    "logo": null,
+    "logo_small": null,
+    "logo_mini": null,
+    "logo_squarred": null,
+    "logo_squarred_small": null,
+    "logo_squarred_mini": null,
+    "accountancy_code_sell": null,
+    "accountancy_code_buy": null,
+    "array_options": {
+      "options_rfltr_model_id": null,
+      "options_sirene_status": null,
+      "options_b4d_spe_name": null,
+      "options_sirene_update_date": "",
+      "options_2iopen_domain": "7",
+      "options_2iopen_structure_type": "12",
+      "options_2iopen_nombre_eleves": null,
+      "options_2iopen_software_used": "4",
+      "options_2iopen_num_portable": null,
+      "options_2iopen_structure_type_cmf": null
+    },
+    "fk_incoterms": null,
+    "location_incoterms": null,
+    "libelle_incoterms": null,
+    "fk_multicurrency": null,
+    "multicurrency_code": null,
+    "id": "1726",
+    "linkedObjectsIds": null,
+    "canvas": null,
+    "fk_project": null,
+    "contact": null,
+    "contact_id": null,
+    "user": null,
+    "origin": null,
+    "origin_id": null,
+    "statut": null,
+    "country": "France",
+    "country_id": "1",
+    "country_code": "FR",
+    "barcode_type": null,
+    "barcode_type_code": null,
+    "barcode_type_label": null,
+    "barcode_type_coder": null,
+    "mode_reglement_id": "2",
+    "cond_reglement_id": "1",
+    "transport_mode_id": null,
+    "cond_reglement": null,
+    "shipping_method_id": null,
+    "modelpdf": null,
+    "last_main_doc": null,
+    "fk_account": "0",
+    "lastname": null,
+    "firstname": null,
+    "civility_id": null,
+    "date_validation": null
+  }
+]