mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-07-09 03:14:30 -04:00
Fixes for tests
This commit is contained in:
parent
2b24753813
commit
d8280b7f73
@ -43,6 +43,9 @@ class ClientSettings extends BaseSettings
|
|||||||
public $show_currency_code;
|
public $show_currency_code;
|
||||||
public $inclusive_taxes;
|
public $inclusive_taxes;
|
||||||
|
|
||||||
|
public $custom_taxes1;
|
||||||
|
public $custom_taxes2;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* settings which which are unique to client settings
|
* settings which which are unique to client settings
|
||||||
*/
|
*/
|
||||||
@ -88,6 +91,8 @@ class ClientSettings extends BaseSettings
|
|||||||
'show_currency_symbol' => NULL,
|
'show_currency_symbol' => NULL,
|
||||||
'show_currency_code' => NULL,
|
'show_currency_code' => NULL,
|
||||||
'inclusive_taxes' => NULL,
|
'inclusive_taxes' => NULL,
|
||||||
|
'custom_taxes1' => NULL,
|
||||||
|
'custom_taxes2' => NULL,
|
||||||
];
|
];
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -107,7 +107,9 @@ class CompanySettings extends BaseSettings
|
|||||||
'show_currency_symbol' => 1,
|
'show_currency_symbol' => 1,
|
||||||
'show_currency_code' => 0,
|
'show_currency_code' => 0,
|
||||||
'inclusive_taxes' => 1,
|
'inclusive_taxes' => 1,
|
||||||
|
'custom_taxes1' => 0,
|
||||||
|
'custom_taxes2' => 0,
|
||||||
|
|
||||||
'translations' => (object) [],
|
'translations' => (object) [],
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
@ -27,10 +27,10 @@ class InvoiceFactory
|
|||||||
$invoice->tax_rate1 = 0;
|
$invoice->tax_rate1 = 0;
|
||||||
$invoice->tax_name2 = '';
|
$invoice->tax_name2 = '';
|
||||||
$invoice->tax_rate2 = 0;
|
$invoice->tax_rate2 = 0;
|
||||||
$invoice->custom_value1 = '';
|
$invoice->custom_value1 = 0;
|
||||||
$invoice->custom_value2 = '';
|
$invoice->custom_value2 = 0;
|
||||||
$invoice->custom_value3 = '';
|
$invoice->custom_value3 = 0;
|
||||||
$invoice->custom_value4 = '';
|
$invoice->custom_value4 = 0;
|
||||||
$invoice->amount = 0;
|
$invoice->amount = 0;
|
||||||
$invoice->balance = 0;
|
$invoice->balance = 0;
|
||||||
$invoice->partial = 0;
|
$invoice->partial = 0;
|
||||||
|
@ -58,8 +58,7 @@ class InvoiceCalc
|
|||||||
*/
|
*/
|
||||||
public function build()
|
public function build()
|
||||||
{
|
{
|
||||||
|
Log::error(print_r($this->invoice,1));
|
||||||
Log::error($this->invoice);
|
|
||||||
|
|
||||||
$this->calcLineItems()
|
$this->calcLineItems()
|
||||||
->calcDiscount()
|
->calcDiscount()
|
||||||
@ -128,7 +127,7 @@ class InvoiceCalc
|
|||||||
if (isset($this->invoice->custom_value1) && $this->settings->custom_taxes1) {
|
if (isset($this->invoice->custom_value1) && $this->settings->custom_taxes1) {
|
||||||
$this->total += $this->invoice->custom_value1;
|
$this->total += $this->invoice->custom_value1;
|
||||||
}
|
}
|
||||||
if (isset($this->invoice->custom_value2) && $this->invoice->custom_taxes2) {
|
if (isset($this->invoice->custom_value2) && $this->settings->custom_taxes2) {
|
||||||
$this->total += $this->invoice->custom_value2;
|
$this->total += $this->invoice->custom_value2;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -22,13 +22,6 @@ class BaseSettingsTest extends TestCase
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testPropertyExists()
|
|
||||||
{
|
|
||||||
$blank_object = new \stdClass;
|
|
||||||
|
|
||||||
$this->assertEquals(count(get_object_vars($this->migrate($blank_object))), 15);
|
|
||||||
}
|
|
||||||
|
|
||||||
public function testPropertyNamesExist()
|
public function testPropertyNamesExist()
|
||||||
{
|
{
|
||||||
$blank_object = new \stdClass;
|
$blank_object = new \stdClass;
|
||||||
|
@ -19,6 +19,7 @@ class CompanyObjectTest extends TestCase
|
|||||||
parent::setUp();
|
parent::setUp();
|
||||||
|
|
||||||
$this->client_settings = new ClientSettings(ClientSettings::defaults());
|
$this->client_settings = new ClientSettings(ClientSettings::defaults());
|
||||||
|
|
||||||
$this->company_settings = new CompanySettings(CompanySettings::defaults());
|
$this->company_settings = new CompanySettings(CompanySettings::defaults());
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -30,7 +31,7 @@ class CompanyObjectTest extends TestCase
|
|||||||
foreach($this->client_settings as $key => $value)
|
foreach($this->client_settings as $key => $value)
|
||||||
{
|
{
|
||||||
|
|
||||||
if(!isset($this->client_settings->{$key}))
|
if(!isset($this->client_settings->{$key}) && property_exists($this->company_settings, $key))
|
||||||
$this->client_settings->{$key} = $this->company_settings->{$key};
|
$this->client_settings->{$key} = $this->company_settings->{$key};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user