2019-10-05 03:48:00 +02:00
|
|
|
<?php
|
2020-09-14 13:11:46 +02:00
|
|
|
/**
|
|
|
|
* Invoice Ninja (https://invoiceninja.com).
|
|
|
|
*
|
|
|
|
* @link https://github.com/invoiceninja/invoiceninja source repository
|
|
|
|
*
|
2021-01-03 22:54:54 +01:00
|
|
|
* @copyright Copyright (c) 2021. Invoice Ninja LLC (https://invoiceninja.com)
|
2020-09-14 13:11:46 +02:00
|
|
|
*
|
|
|
|
* @license https://opensource.org/licenses/AAL
|
|
|
|
*/
|
2019-10-05 03:48:00 +02:00
|
|
|
namespace Tests\Feature;
|
|
|
|
|
|
|
|
use Illuminate\Foundation\Testing\DatabaseTransactions;
|
|
|
|
use Tests\MockAccountData;
|
|
|
|
use Tests\TestCase;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @test
|
|
|
|
* @covers App\Models\Presenters\ClientPresenter
|
|
|
|
*/
|
|
|
|
class ClientPresenterTest extends TestCase
|
|
|
|
{
|
2020-03-21 06:37:30 +01:00
|
|
|
use MockAccountData;
|
2019-10-05 03:48:00 +02:00
|
|
|
use DatabaseTransactions;
|
|
|
|
|
|
|
|
public function setUp() :void
|
|
|
|
{
|
2020-03-21 06:37:30 +01:00
|
|
|
parent::setUp();
|
2020-09-06 11:38:10 +02:00
|
|
|
|
2020-03-21 06:37:30 +01:00
|
|
|
$this->makeTestData();
|
|
|
|
}
|
2019-10-05 03:48:00 +02:00
|
|
|
|
2020-03-21 06:37:30 +01:00
|
|
|
public function testCompanyName()
|
|
|
|
{
|
|
|
|
$settings = $this->client->company->settings;
|
2019-10-05 03:48:00 +02:00
|
|
|
|
2020-03-21 06:37:30 +01:00
|
|
|
$settings->name = 'test';
|
|
|
|
$this->client->company->settings = $settings;
|
|
|
|
$this->client->company->save();
|
2020-09-06 11:38:10 +02:00
|
|
|
|
2020-03-21 06:37:30 +01:00
|
|
|
$this->client->getSetting('name');
|
2019-10-05 03:48:00 +02:00
|
|
|
|
2020-03-21 06:37:30 +01:00
|
|
|
$merged_settings = $this->client->getMergedSettings();
|
2019-10-05 03:48:00 +02:00
|
|
|
|
2020-03-21 06:37:30 +01:00
|
|
|
$name = $this->client->present()->company_name();
|
2019-10-05 03:48:00 +02:00
|
|
|
|
2020-03-21 06:37:30 +01:00
|
|
|
$this->assertEquals('test', $merged_settings->name);
|
|
|
|
$this->assertEquals('test', $name);
|
|
|
|
}
|
2019-10-05 03:48:00 +02:00
|
|
|
|
2020-03-21 06:37:30 +01:00
|
|
|
public function testCompanyAddress()
|
|
|
|
{
|
|
|
|
$this->assertNotNull($this->client->present()->company_address());
|
|
|
|
}
|
|
|
|
}
|