mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-06-01 00:14:33 -04:00
More tests for group settings
This commit is contained in:
parent
b7920a072a
commit
a614dc5cda
@ -103,7 +103,7 @@ class CompanyTest extends TestCase
|
|||||||
)
|
)
|
||||||
->assertStatus(302);
|
->assertStatus(302);
|
||||||
|
|
||||||
Log::error($company);
|
// Log::error($company);
|
||||||
|
|
||||||
$token = CompanyToken::whereCompanyId($company->id)->first()->token;
|
$token = CompanyToken::whereCompanyId($company->id)->first()->token;
|
||||||
|
|
||||||
|
@ -110,4 +110,86 @@ class GroupSettingsTest extends TestCase
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public function testClientPriority()
|
||||||
|
{
|
||||||
|
$cs = $this->client->company->settings;
|
||||||
|
$cs->timezone_id = 'COMPANY';
|
||||||
|
|
||||||
|
$this->client->company->settings = $cs;
|
||||||
|
|
||||||
|
$gs = $this->client->group_settings->settings;
|
||||||
|
$gs->timezone_id = 'GROUP';
|
||||||
|
|
||||||
|
$this->client->group_settings->settings = $gs;
|
||||||
|
|
||||||
|
$cls = $this->client->settings;
|
||||||
|
$cls->timezone_id = 'CLIENT';
|
||||||
|
|
||||||
|
$this->client->settings = $cls;
|
||||||
|
|
||||||
|
$this->client->group_settings->save();
|
||||||
|
$this->client->company->save();
|
||||||
|
$this->client->save();
|
||||||
|
|
||||||
|
$this->client->fresh();
|
||||||
|
|
||||||
|
$this->assertEquals($this->client->getSetting('timezone_id'), 'CLIENT');
|
||||||
|
$this->assertEquals($this->client->getMergedSettings()->timezone_id, 'CLIENT');
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public function testGroupPriority()
|
||||||
|
{
|
||||||
|
$cs = $this->client->company->settings;
|
||||||
|
$cs->timezone_id = 'COMPANY';
|
||||||
|
|
||||||
|
$this->client->company->settings = $cs;
|
||||||
|
|
||||||
|
$gs = $this->client->group_settings->settings;
|
||||||
|
$gs->timezone_id = 'GROUP';
|
||||||
|
|
||||||
|
$this->client->group_settings->settings = $gs;
|
||||||
|
|
||||||
|
$cls = $this->client->settings;
|
||||||
|
$cls->timezone_id = NULL;
|
||||||
|
|
||||||
|
$this->client->settings = $cls;
|
||||||
|
|
||||||
|
$this->client->group_settings->save();
|
||||||
|
$this->client->company->save();
|
||||||
|
$this->client->save();
|
||||||
|
|
||||||
|
$this->client->fresh();
|
||||||
|
|
||||||
|
$this->assertEquals($this->client->getSetting('timezone_id'), 'GROUP');
|
||||||
|
$this->assertEquals($this->client->getMergedSettings()->timezone_id, 'GROUP');
|
||||||
|
}
|
||||||
|
|
||||||
|
public function testCompanyFallBackPriority()
|
||||||
|
{
|
||||||
|
$cs = $this->client->company->settings;
|
||||||
|
$cs->timezone_id = 'COMPANY';
|
||||||
|
|
||||||
|
$this->client->company->settings = $cs;
|
||||||
|
|
||||||
|
$gs = $this->client->group_settings->settings;
|
||||||
|
$gs->timezone_id = NULL;
|
||||||
|
|
||||||
|
$this->client->group_settings->settings = $gs;
|
||||||
|
|
||||||
|
$cls = $this->client->settings;
|
||||||
|
$cls->timezone_id = NULL;
|
||||||
|
|
||||||
|
$this->client->settings = $cls;
|
||||||
|
|
||||||
|
$this->client->group_settings->save();
|
||||||
|
$this->client->company->save();
|
||||||
|
$this->client->save();
|
||||||
|
|
||||||
|
$this->client->fresh();
|
||||||
|
|
||||||
|
$this->assertEquals($this->client->getSetting('timezone_id'), 'COMPANY');
|
||||||
|
$this->assertEquals($this->client->getMergedSettings()->timezone_id, 'COMPANY');
|
||||||
|
}
|
||||||
}
|
}
|
Loading…
x
Reference in New Issue
Block a user