mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2024-11-10 13:12:50 +01:00
Fixes for tests
This commit is contained in:
parent
59e3978374
commit
0894752c80
@ -120,6 +120,9 @@ trait CompanySettingsSaver
|
|||||||
elseif (substr($key, -3) == '_id' || substr($key, -14) == 'number_counter') {
|
elseif (substr($key, -3) == '_id' || substr($key, -14) == 'number_counter') {
|
||||||
$value = 'integer';
|
$value = 'integer';
|
||||||
|
|
||||||
|
if($key == 'besr_id')
|
||||||
|
$value = 'string';
|
||||||
|
|
||||||
if (! property_exists($settings, $key)) {
|
if (! property_exists($settings, $key)) {
|
||||||
continue;
|
continue;
|
||||||
} elseif (! $this->checkAttribute($value, $settings->{$key})) {
|
} elseif (! $this->checkAttribute($value, $settings->{$key})) {
|
||||||
@ -187,6 +190,9 @@ trait CompanySettingsSaver
|
|||||||
if($key == 'gmail_sending_user_id')
|
if($key == 'gmail_sending_user_id')
|
||||||
$value = 'string';
|
$value = 'string';
|
||||||
|
|
||||||
|
if($key == 'besr_id')
|
||||||
|
$value = 'string';
|
||||||
|
|
||||||
if (! property_exists($settings, $key)) {
|
if (! property_exists($settings, $key)) {
|
||||||
continue;
|
continue;
|
||||||
} elseif ($this->checkAttribute($value, $settings->{$key})) {
|
} elseif ($this->checkAttribute($value, $settings->{$key})) {
|
||||||
|
@ -55,7 +55,7 @@ trait SettingsSaver
|
|||||||
elseif (substr($key, -3) == '_id' || substr($key, -14) == 'number_counter' || ($key == 'payment_terms' && strlen($settings->{$key}) >= 1) || ($key == 'valid_until' && strlen($settings->{$key}) >= 1)) {
|
elseif (substr($key, -3) == '_id' || substr($key, -14) == 'number_counter' || ($key == 'payment_terms' && strlen($settings->{$key}) >= 1) || ($key == 'valid_until' && strlen($settings->{$key}) >= 1)) {
|
||||||
$value = 'integer';
|
$value = 'integer';
|
||||||
|
|
||||||
if($key == 'gmail_sending_user_id')
|
if($key == 'gmail_sending_user_id' || $key == 'besr_id')
|
||||||
$value = 'string';
|
$value = 'string';
|
||||||
|
|
||||||
if (! property_exists($settings, $key)) {
|
if (! property_exists($settings, $key)) {
|
||||||
|
@ -56,7 +56,7 @@ class CompanySettingsTest extends TestCase
|
|||||||
$response = $this->withHeaders([
|
$response = $this->withHeaders([
|
||||||
'X-API-SECRET' => config('ninja.api_secret'),
|
'X-API-SECRET' => config('ninja.api_secret'),
|
||||||
'X-API-Token' => $this->token,
|
'X-API-Token' => $this->token,
|
||||||
])->put('/api/v1/companies/'.$this->encodePrimaryKey($this->company->id), $this->company->toArray());
|
])->putJson('/api/v1/companies/'.$this->encodePrimaryKey($this->company->id), $this->company->toArray());
|
||||||
} catch (ValidationException $e) {
|
} catch (ValidationException $e) {
|
||||||
$message = json_decode($e->validator->getMessageBag(), 1);
|
$message = json_decode($e->validator->getMessageBag(), 1);
|
||||||
}
|
}
|
||||||
@ -78,11 +78,13 @@ class CompanySettingsTest extends TestCase
|
|||||||
|
|
||||||
$this->company->saveSettings($settings, $this->company);
|
$this->company->saveSettings($settings, $this->company);
|
||||||
|
|
||||||
|
$response = false;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
$response = $this->withHeaders([
|
$response = $this->withHeaders([
|
||||||
'X-API-SECRET' => config('ninja.api_secret'),
|
'X-API-SECRET' => config('ninja.api_secret'),
|
||||||
'X-API-Token' => $this->token,
|
'X-API-Token' => $this->token,
|
||||||
])->put('/api/v1/companies/'.$this->encodePrimaryKey($this->company->id), $this->company->toArray());
|
])->putJson('/api/v1/companies/'.$this->encodePrimaryKey($this->company->id), $this->company->toArray());
|
||||||
} catch (ValidationException $e) {
|
} catch (ValidationException $e) {
|
||||||
$message = json_decode($e->validator->getMessageBag(), 1);
|
$message = json_decode($e->validator->getMessageBag(), 1);
|
||||||
nlog($message);
|
nlog($message);
|
||||||
@ -109,7 +111,7 @@ class CompanySettingsTest extends TestCase
|
|||||||
$response = $this->withHeaders([
|
$response = $this->withHeaders([
|
||||||
'X-API-SECRET' => config('ninja.api_secret'),
|
'X-API-SECRET' => config('ninja.api_secret'),
|
||||||
'X-API-Token' => $this->token,
|
'X-API-Token' => $this->token,
|
||||||
])->put('/api/v1/companies/'.$this->encodePrimaryKey($this->company->id), $this->company->toArray());
|
])->putJson('/api/v1/companies/'.$this->encodePrimaryKey($this->company->id), $this->company->toArray());
|
||||||
|
|
||||||
$response->assertStatus(200);
|
$response->assertStatus(200);
|
||||||
|
|
||||||
@ -135,7 +137,7 @@ class CompanySettingsTest extends TestCase
|
|||||||
$response = $this->withHeaders([
|
$response = $this->withHeaders([
|
||||||
'X-API-SECRET' => config('ninja.api_secret'),
|
'X-API-SECRET' => config('ninja.api_secret'),
|
||||||
'X-API-Token' => $this->token,
|
'X-API-Token' => $this->token,
|
||||||
])->put('/api/v1/companies/'.$this->encodePrimaryKey($this->company->id), $this->company->toArray());
|
])->putJson('/api/v1/companies/'.$this->encodePrimaryKey($this->company->id), $this->company->toArray());
|
||||||
|
|
||||||
$response->assertStatus(200);
|
$response->assertStatus(200);
|
||||||
|
|
||||||
@ -162,7 +164,7 @@ class CompanySettingsTest extends TestCase
|
|||||||
$response = $this->withHeaders([
|
$response = $this->withHeaders([
|
||||||
'X-API-SECRET' => config('ninja.api_secret'),
|
'X-API-SECRET' => config('ninja.api_secret'),
|
||||||
'X-API-Token' => $this->token,
|
'X-API-Token' => $this->token,
|
||||||
])->put('/api/v1/companies/'.$this->encodePrimaryKey($this->company->id), $this->company->toArray());
|
])->putJson('/api/v1/companies/'.$this->encodePrimaryKey($this->company->id), $this->company->toArray());
|
||||||
|
|
||||||
$response->assertStatus(200);
|
$response->assertStatus(200);
|
||||||
|
|
||||||
@ -185,7 +187,7 @@ class CompanySettingsTest extends TestCase
|
|||||||
$response = $this->withHeaders([
|
$response = $this->withHeaders([
|
||||||
'X-API-SECRET' => config('ninja.api_secret'),
|
'X-API-SECRET' => config('ninja.api_secret'),
|
||||||
'X-API-Token' => $this->token,
|
'X-API-Token' => $this->token,
|
||||||
])->post('/api/v1/companies?include=company', $this->company->toArray());
|
])->postJson('/api/v1/companies?include=company', $this->company->toArray());
|
||||||
|
|
||||||
$arr = $response->json();
|
$arr = $response->json();
|
||||||
$response->assertStatus(200);
|
$response->assertStatus(200);
|
||||||
@ -203,7 +205,7 @@ class CompanySettingsTest extends TestCase
|
|||||||
$response = $this->withHeaders([
|
$response = $this->withHeaders([
|
||||||
'X-API-SECRET' => config('ninja.api_secret'),
|
'X-API-SECRET' => config('ninja.api_secret'),
|
||||||
'X-API-Token' => $this->token,
|
'X-API-Token' => $this->token,
|
||||||
])->post('/api/v1/companies?include=company', $this->company->toArray());
|
])->postJson('/api/v1/companies?include=company', $this->company->toArray());
|
||||||
|
|
||||||
$arr = $response->json();
|
$arr = $response->json();
|
||||||
$response->assertStatus(200);
|
$response->assertStatus(200);
|
||||||
@ -221,7 +223,7 @@ class CompanySettingsTest extends TestCase
|
|||||||
$response = $this->withHeaders([
|
$response = $this->withHeaders([
|
||||||
'X-API-SECRET' => config('ninja.api_secret'),
|
'X-API-SECRET' => config('ninja.api_secret'),
|
||||||
'X-API-Token' => $this->token,
|
'X-API-Token' => $this->token,
|
||||||
])->post('/api/v1/companies?include=company', $this->company->toArray());
|
])->postJson('/api/v1/companies?include=company', $this->company->toArray());
|
||||||
|
|
||||||
$arr = $response->json();
|
$arr = $response->json();
|
||||||
$response->assertStatus(200);
|
$response->assertStatus(200);
|
||||||
@ -239,7 +241,7 @@ class CompanySettingsTest extends TestCase
|
|||||||
$response = $this->withHeaders([
|
$response = $this->withHeaders([
|
||||||
'X-API-SECRET' => config('ninja.api_secret'),
|
'X-API-SECRET' => config('ninja.api_secret'),
|
||||||
'X-API-Token' => $this->token,
|
'X-API-Token' => $this->token,
|
||||||
])->post('/api/v1/companies?include=company', $this->company->toArray());
|
])->postJson('/api/v1/companies?include=company', $this->company->toArray());
|
||||||
|
|
||||||
$arr = $response->json();
|
$arr = $response->json();
|
||||||
$response->assertStatus(200);
|
$response->assertStatus(200);
|
||||||
|
Loading…
Reference in New Issue
Block a user