mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-05-24 02:14:21 -04:00
enforce settype() for strings that are _ids (#3010)
* Add Includes * Clean up company settings + tests * Update Company Settings Schema * Fixes for tests * fixes for tests * fixes for settings * Enforce settype(string) for _ids
This commit is contained in:
parent
e4f0b08d3e
commit
9dfa97eedf
@ -123,7 +123,12 @@ trait SettingsSaver
|
||||
continue;
|
||||
}
|
||||
elseif($this->checkAttribute($value, $settings->{$key})){
|
||||
settype($settings->{$key}, $value);
|
||||
|
||||
if(substr($key, -3) == '_id')
|
||||
settype($settings->{$key}, 'string');
|
||||
else
|
||||
settype($settings->{$key}, $value);
|
||||
|
||||
}
|
||||
else {
|
||||
unset($settings->{$key});
|
||||
|
@ -119,6 +119,8 @@ class CompanyTest extends TestCase
|
||||
|
||||
$settings = new \stdClass;
|
||||
$settings->custom_value1 = 'test';
|
||||
$settings->invoice_design_id = '2';
|
||||
$settings->quote_design_id = 1;
|
||||
|
||||
$company->settings = $settings;
|
||||
|
||||
@ -128,7 +130,14 @@ class CompanyTest extends TestCase
|
||||
])->put('/api/v1/companies/'.$this->encodePrimaryKey($company->id), $company->toArray())
|
||||
->assertStatus(200)->decodeResponseJson();
|
||||
|
||||
\Log::error($response);
|
||||
|
||||
$response = $this->withHeaders([
|
||||
'X-API-SECRET' => config('ninja.api_secret'),
|
||||
'X-API-TOKEN' => $token,
|
||||
])->get('/api/v1/companies/'.$this->encodePrimaryKey($company->id))
|
||||
->assertStatus(200)->decodeResponseJson();
|
||||
|
||||
//\Log::error($response);
|
||||
//$this->assertEquals(1, $response['data']['size_id']);
|
||||
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user