2019-02-17 21:34:46 +11:00
|
|
|
<?php
|
|
|
|
|
|
|
|
|
|
namespace Tests\Unit;
|
|
|
|
|
|
|
|
|
|
use App\DataMapper\CompanySettings;
|
|
|
|
|
use Tests\TestCase;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @test
|
|
|
|
|
* @covers App\DataMapper\CompanySettings
|
|
|
|
|
*/
|
|
|
|
|
class CompanySettingsTest extends TestCase
|
|
|
|
|
{
|
|
|
|
|
|
2019-04-24 20:01:40 +10:00
|
|
|
public function setUp() :void
|
2019-02-17 21:34:46 +11:00
|
|
|
{
|
|
|
|
|
|
|
|
|
|
parent::setUp();
|
|
|
|
|
|
|
|
|
|
$this->company_settings = CompanySettings::defaults();
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public function testTimezoneId()
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
$this->assertEquals($this->company_settings->timezone_id, 15);
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public function testLanguageId()
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
$this->assertEquals($this->company_settings->language_id, 1);
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
2019-09-19 15:50:05 +10:00
|
|
|
public function testPropertyIssetOk()
|
2019-02-17 21:34:46 +11:00
|
|
|
{
|
|
|
|
|
|
2019-10-10 14:48:09 +11:00
|
|
|
$this->assertTrue(isset($this->company_settings->custom_value1));
|
2019-02-17 21:34:46 +11:00
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public function testPropertyIsSet()
|
|
|
|
|
{
|
|
|
|
|
|
2019-09-11 12:01:49 +10:00
|
|
|
$this->assertTrue(isset($this->company_settings->timezone_id));
|
2019-02-17 21:34:46 +11:00
|
|
|
|
|
|
|
|
}
|
2019-10-09 23:21:21 +11:00
|
|
|
|
2019-10-23 12:01:25 +11:00
|
|
|
public function testSettingsArrayAgainstCastsArray()
|
|
|
|
|
{
|
|
|
|
|
$company_settings = json_decode(json_encode(CompanySettings::defaults()),true);
|
|
|
|
|
$casts = CompanySettings::$casts;
|
|
|
|
|
|
|
|
|
|
$diff = array_diff_key($company_settings, $casts);
|
2019-11-07 09:57:09 +11:00
|
|
|
|
2019-10-23 12:01:25 +11:00
|
|
|
$this->assertEquals(1, count($diff));
|
|
|
|
|
}
|
|
|
|
|
|
2019-02-17 21:34:46 +11:00
|
|
|
}
|