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