1
0
mirror of https://github.com/invoiceninja/invoiceninja.git synced 2024-11-18 09:04:35 +01:00
invoiceninja/tests/Unit/CompareObjectTest.php

62 lines
1.7 KiB
PHP
Raw Normal View History

<?php
2020-09-14 13:11:46 +02:00
/**
* Invoice Ninja (https://invoiceninja.com).
*
* @link https://github.com/invoiceninja/invoiceninja source repository
*
* @copyright Copyright (c) 2021. Invoice Ninja LLC (https://invoiceninja.com)
2020-09-14 13:11:46 +02:00
*
* @license https://opensource.org/licenses/AAL
*/
namespace Tests\Unit;
use App\DataMapper\ClientSettings;
use App\DataMapper\CompanySettings;
use Tests\TestCase;
/**
* @test
* @covers App\DataMapper\ClientSettings
*/
2019-04-24 12:01:40 +02:00
class CompareObjectTest extends TestCase
{
2019-04-24 12:01:40 +02:00
public function setUp() :void
{
parent::setUp();
$this->client_settings = ClientSettings::defaults();
$this->company_settings = CompanySettings::defaults();
}
public function buildClientSettings()
{
foreach ($this->company_settings as $key => $value) {
if (! isset($this->client_settings->{$key}) && property_exists($this->company_settings, $key)) {
$this->client_settings->{$key} = $this->company_settings->{$key};
}
}
return $this->client_settings;
}
public function testProperties()
{
$build_client_settings = $this->buildClientSettings();
2019-04-24 12:01:40 +02:00
$this->assertEquals($build_client_settings->timezone_id, 1);
$this->assertEquals($build_client_settings->language_id, 1);
$this->assertEquals($build_client_settings->payment_terms, '');
}
2019-04-24 12:01:40 +02:00
public function testDirectClientSettingsBuild()
{
$settings = ClientSettings::buildClientSettings(CompanySettings::defaults(), ClientSettings::defaults());
$this->assertEquals($settings->timezone_id, 1);
$this->assertEquals($settings->language_id, 1);
$this->assertEquals($settings->payment_terms, '');
2020-06-11 23:56:25 +02:00
$this->assertFalse($settings->auto_archive_invoice);
}
}