1
0
mirror of https://github.com/invoiceninja/invoiceninja.git synced 2024-11-14 07:02:34 +01:00
invoiceninja/tests/Integration/UpdateCompanyLedgerTest.php
Benjamin Beganović ae88d5e08e php-cs-fixer format
2020-11-25 15:19:52 +01:00

57 lines
1.4 KiB
PHP

<?php
/**
* Invoice Ninja (https://invoiceninja.com).
*
* @link https://github.com/invoiceninja/invoiceninja source repository
*
* @copyright Copyright (c) 2020. Invoice Ninja LLC (https://invoiceninja.com)
*
* @license https://opensource.org/licenses/AAL
*/
namespace Tests\Integration;
use App\Models\CompanyLedger;
use Illuminate\Foundation\Testing\DatabaseTransactions;
use Tests\MockAccountData;
use Tests\TestCase;
/** @test*/
class UpdateCompanyLedgerTest extends TestCase
{
use MockAccountData;
use DatabaseTransactions;
public function setUp() :void
{
parent::setUp();
$this->makeTestData();
}
/**
* @test
*/
public function testPaymentIsPresentInLedger()
{
$invoice = $this->invoice->service()->markPaid()->save();
$ledger = CompanyLedger::whereClientId($invoice->client_id)
->whereCompanyId($invoice->company_id)
->orderBy('id', 'DESC')
->first();
$payment = $ledger->adjustment * -1;
$this->assertEquals($invoice->amount, $payment);
}
/**
* @test
*/
public function testInvoiceIsPresentInLedger()
{
$invoice = $this->invoice->service()->markPaid()->save();
$this->assertGreaterThan(0, $invoice->company_ledger()->count());
}
}