mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-09-05 12:12:18 +00:00
Fixed some test coverage.
This commit is contained in:
@@ -163,7 +163,7 @@ class Amount
|
||||
return $currency->code;
|
||||
}
|
||||
|
||||
return 'EUR';
|
||||
return 'EUR'; // @codeCoverageIgnore
|
||||
}
|
||||
|
||||
/**
|
||||
|
@@ -13,6 +13,7 @@ use Preferences as Prefs;
|
||||
/**
|
||||
* Class CacheProperties
|
||||
*
|
||||
* @codeCoverageIgnore
|
||||
* @package FireflyIII\Support
|
||||
*/
|
||||
class CacheProperties
|
||||
|
@@ -57,6 +57,8 @@ class TransactionJournalModelTest extends TestCase
|
||||
|
||||
/**
|
||||
* @covers FireflyIII\Models\TransactionJournal::getAmountAttribute
|
||||
* @covers FireflyIII\Models\TransactionJournal::amountByTag
|
||||
* @covers FireflyIII\Models\TransactionJournal::amountByTags
|
||||
* @SuppressWarnings(PHPMD.ExcessiveMethodLength)
|
||||
*/
|
||||
public function testGetAmountAttributeAdvancePayment()
|
||||
@@ -115,8 +117,11 @@ class TransactionJournalModelTest extends TestCase
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @covers FireflyIII\Models\TransactionJournal::getAmountAttribute
|
||||
* @covers FireflyIII\Models\TransactionJournal::amountByTag
|
||||
* @covers FireflyIII\Models\TransactionJournal::amountByTags
|
||||
* @SuppressWarnings(PHPMD.ExcessiveMethodLength)
|
||||
*/
|
||||
public function testGetAmountAttributeBalancingAct()
|
||||
@@ -178,6 +183,8 @@ class TransactionJournalModelTest extends TestCase
|
||||
|
||||
/**
|
||||
* @covers FireflyIII\Models\TransactionJournal::getAmountAttribute
|
||||
* @covers FireflyIII\Models\TransactionJournal::amountByTag
|
||||
* @covers FireflyIII\Models\TransactionJournal::amountByTags
|
||||
*/
|
||||
public function testGetAmountAttributeNoTags()
|
||||
{
|
||||
@@ -197,6 +204,8 @@ class TransactionJournalModelTest extends TestCase
|
||||
|
||||
/**
|
||||
* @covers FireflyIII\Models\TransactionJournal::getAmountAttribute
|
||||
* @covers FireflyIII\Models\TransactionJournal::amountByTag
|
||||
* @covers FireflyIII\Models\TransactionJournal::amountByTags
|
||||
*/
|
||||
public function testGetAmountAttributeTag()
|
||||
{
|
||||
@@ -233,6 +242,51 @@ class TransactionJournalModelTest extends TestCase
|
||||
$this->assertEquals('300', $withdrawal->amount);
|
||||
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers FireflyIII\Models\TransactionJournal::getAmountAttribute
|
||||
* @covers FireflyIII\Models\TransactionJournal::amountByTag
|
||||
* @covers FireflyIII\Models\TransactionJournal::amountByTags
|
||||
*/
|
||||
public function testGetAmountAttributeTags()
|
||||
{
|
||||
$user = FactoryMuffin::create('FireflyIII\User');
|
||||
$this->be($user);
|
||||
|
||||
// has two normal tags:
|
||||
$tag = FactoryMuffin::create('FireflyIII\Models\Tag');
|
||||
$tag->tagMode = 'nothing';
|
||||
$tag->save();
|
||||
$tag2 = FactoryMuffin::create('FireflyIII\Models\Tag');
|
||||
$tag2->tagMode = 'nothing';
|
||||
$tag2->save();
|
||||
|
||||
// make withdrawal
|
||||
$withdrawalType = FactoryMuffin::create('FireflyIII\Models\TransactionType');
|
||||
$withdrawal = FactoryMuffin::create('FireflyIII\Models\TransactionJournal');
|
||||
$withdrawal->transaction_type_id = $withdrawalType->id;
|
||||
$withdrawal->save();
|
||||
|
||||
// make accounts
|
||||
$expense = FactoryMuffin::create('FireflyIII\Models\Account');
|
||||
$asset = FactoryMuffin::create('FireflyIII\Models\Account');
|
||||
|
||||
$withdrawal->transactions[0]->amount = -300;
|
||||
$withdrawal->transactions[0]->account_id = $asset->id;
|
||||
$withdrawal->transactions[0]->save();
|
||||
|
||||
$withdrawal->transactions[1]->amount = 300;
|
||||
$withdrawal->transactions[1]->account_id = $expense->id;
|
||||
$withdrawal->transactions[1]->save();
|
||||
|
||||
// connect to tag:
|
||||
$tag->transactionJournals()->save($withdrawal);
|
||||
$tag2->transactionJournals()->save($withdrawal);
|
||||
|
||||
$this->assertEquals('300', $withdrawal->amount);
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -365,7 +419,7 @@ class TransactionJournalModelTest extends TestCase
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers FireflyIII\Models\TransactionJournal::getDestinationAccountAttribute
|
||||
* @covers FireflyIII\Models\TransactionJournal::getSourceAccountAttribute
|
||||
*/
|
||||
public function testGetSourceAccountAttribute()
|
||||
{
|
||||
|
@@ -300,6 +300,8 @@ class BillRepositoryTest extends TestCase
|
||||
* @SuppressWarnings(PHPMD.ExcessiveMethodLength)
|
||||
*
|
||||
* @covers FireflyIII\Repositories\Bill\BillRepository::scan
|
||||
* @covers FireflyIII\Repositories\Bill\BillRepository::doWordMatch
|
||||
* @covers FireflyIII\Repositories\Bill\BillRepository::doAmountMatch
|
||||
*/
|
||||
public function testScanMatch()
|
||||
{
|
||||
@@ -329,6 +331,8 @@ class BillRepositoryTest extends TestCase
|
||||
|
||||
/**
|
||||
* @covers FireflyIII\Repositories\Bill\BillRepository::scan
|
||||
* @covers FireflyIII\Repositories\Bill\BillRepository::doWordMatch
|
||||
* @covers FireflyIII\Repositories\Bill\BillRepository::doAmountMatch
|
||||
*/
|
||||
public function testScanNoMatch()
|
||||
{
|
||||
@@ -370,6 +374,8 @@ class BillRepositoryTest extends TestCase
|
||||
|
||||
/**
|
||||
* @covers FireflyIII\Repositories\Bill\BillRepository::scan
|
||||
* @covers FireflyIII\Repositories\Bill\BillRepository::doWordMatch
|
||||
* @covers FireflyIII\Repositories\Bill\BillRepository::doAmountMatch
|
||||
*/
|
||||
public function testScanNoMatchButAttached()
|
||||
{
|
||||
|
@@ -36,6 +36,17 @@ class AmountSupportTest extends TestCase
|
||||
parent::tearDown();
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers FireflyIII\Support\Amount::format
|
||||
* @covers FireflyIII\Support\Amount::getCurrencySymbol
|
||||
*/
|
||||
public function testFormat()
|
||||
{
|
||||
$amount = '123';
|
||||
$result = $this->object->format($amount, true);
|
||||
$this->assertTrue(str_contains($result, $amount));
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers FireflyIII\Support\Amount::formatJournal
|
||||
*/
|
||||
|
Reference in New Issue
Block a user