Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
62 changes: 62 additions & 0 deletions test/Api/SettingsApiTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -260,4 +260,66 @@ public function testModifyPaymentMethod()

TestCase::assertEquals($obj, $result);
}

/**
* Test case for getTaxProfile
*
* Get Tax Profile.
*
*/
public function testGetTaxProfile()
{
$stream = '{
"data": {
"company_type": "individual",
"company_subtype": "artigiani",
"profession": "test",
"regime": "forfettario_5",
"rivalsa_name": "",
"default_rivalsa": 0,
"cassa_name": "",
"default_cassa": 0,
"default_cassa_taxable": 100,
"cassa2_name": "",
"default_cassa2": 0,
"default_cassa2_taxable": 0,
"default_withholding_tax": 0,
"default_withholding_tax_taxable": 100,
"default_other_withholding_tax": 0,
"enasarco": false,
"enasarco_type": "null",
"contributions_percentage": 0,
"med": false,
"default_vat": {
"id": 66,
"value": 0,
"description": "Contribuenti forfettari",
"notes": "Operazione non soggetta a IVA ai sensi dell\'art. 1, commi 54-89, Legge n. 190\/2014 e succ. modifiche\/integrazioni",
"e_invoice": true,
"ei_type": "2.2",
"ei_description": "Non soggetta art. 1\/54-89 L. 190\/2014 e succ. modifiche\/integrazioni",
"editable": false,
"is_disabled": false,
"default": true
}
}
}';
$mock = new MockHandler([new Response(
200,
['Content-Type' => 'application/json'],
$stream
)]);

$handler = HandlerStack::create($mock);
$apiInstance = new \FattureInCloud\Api\SettingsApi(
new \GuzzleHttp\Client(['handler' => $handler])
);
$company_id = 2;
$result = $apiInstance->getTaxProfile($company_id);
$obj = ObjectSerializer::deserialize($stream, '\FattureInCloud\Model\GetTaxProfileResponse');

TestCase::assertEquals($obj, $result);
}


}
53 changes: 49 additions & 4 deletions test/Model/GetTaxProfileResponseTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@

namespace FattureInCloud\Test\Model;

use FattureInCloud\ObjectSerializer;
use PHPUnit\Framework\TestCase;

/**
Expand All @@ -42,6 +43,9 @@
*/
class GetTaxProfileResponseTest extends TestCase
{
public $array = [];
public $object;

/**
* Setup before running any test case
*/
Expand All @@ -54,6 +58,45 @@ public static function setUpBeforeClass(): void
*/
public function setUp(): void
{
$json = '{
"data": {
"company_type": "individual",
"company_subtype": "artigiani",
"profession": "test",
"regime": "forfettario_5",
"rivalsa_name": "",
"default_rivalsa": 0,
"cassa_name": "",
"default_cassa": 0,
"default_cassa_taxable": 100,
"cassa2_name": "",
"default_cassa2": 0,
"default_cassa2_taxable": 0,
"default_withholding_tax": 0,
"default_withholding_tax_taxable": 100,
"default_other_withholding_tax": 0,
"enasarco": false,
"enasarco_type": "null",
"contributions_percentage": 0,
"med": false,
"default_vat": {
"id": 66,
"value": 0,
"description": "Contribuenti forfettari",
"notes": "Operazione non soggetta a IVA ai sensi dell\'art. 1, commi 54-89, Legge n. 190\/2014 e succ. modifiche\/integrazioni",
"e_invoice": true,
"ei_type": "2.2",
"ei_description": "Non soggetta art. 1\/54-89 L. 190\/2014 e succ. modifiche\/integrazioni",
"editable": false,
"is_disabled": false,
"default": true
}
}
}';

$this->array = json_decode($json, true);

$this->object = ObjectSerializer::deserialize($json, '\FattureInCloud\Model\GetTaxProfileResponse');
}

/**
Expand All @@ -75,16 +118,18 @@ public static function tearDownAfterClass(): void
*/
public function testGetTaxProfileResponse()
{
// TODO: implement
self::markTestIncomplete('Not implemented');
foreach ($this->array as $key => $value) {
Testcase::assertArrayHasKey($key, $this->object);
}
}

/**
* Test attribute "data"
*/
public function testPropertyData()
{
// TODO: implement
self::markTestIncomplete('Not implemented');
foreach ($this->array['data'] as $key => $value) {
Testcase::assertArrayHasKey($key, $this->object['data']);
}
}
}
Loading