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

57 lines
1.4 KiB
PHP
Raw Normal View History

2019-05-16 07:36:53 +02:00
<?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
*/
2019-05-16 07:36:53 +02:00
namespace Tests\Integration;
use App\Models\CompanyLedger;
use Illuminate\Foundation\Testing\DatabaseTransactions;
use Tests\MockAccountData;
use Tests\TestCase;
/** @test*/
2019-05-16 07:36:53 +02:00
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();
2019-05-16 07:36:53 +02:00
$ledger = CompanyLedger::whereClientId($invoice->client_id)
->whereCompanyId($invoice->company_id)
->orderBy('id', 'DESC')
->first();
$payment = $ledger->adjustment * -1;
2019-05-16 07:36:53 +02:00
$this->assertEquals($invoice->amount, $payment);
}
/**
* @test
*/
public function testInvoiceIsPresentInLedger()
{
$invoice = $this->invoice->service()->markPaid()->save();
2019-05-16 07:36:53 +02:00
$this->assertGreaterThan(0, $invoice->company_ledger()->count());
2019-05-16 07:36:53 +02:00
}
}