firefly-iii/tests/unit/TransactionTest.php

68 lines
1.7 KiB
PHP
Raw Normal View History

2015-01-01 06:32:31 -06:00
<?php
use League\FactoryMuffin\Facade as f;
/**
* Class TransactionTest
*/
class TransactionTest extends TestCase
{
public function setUp()
{
parent::setUp();
}
public function tearDown()
{
parent::tearDown();
}
public function testAccount()
{
$transaction = f::create('Transaction');
$this->assertCount(1, Transaction::accountIs($transaction->account)->get());
}
public function testDateAfter()
{
$transaction = f::create('Transaction');
$date = clone $transaction->transactionJournal->date;
$date->subDay();
$this->assertCount(1, Transaction::after($date)->get());
}
public function testDateBefore()
{
$transaction = f::create('Transaction');
$date = clone $transaction->transactionJournal->date;
$date->addDay();
$this->assertCount(1, Transaction::before($date)->get());
}
public function testLessThan()
{
$transaction = f::create('Transaction');
$amount = floatval($transaction->amount);
2015-01-01 15:51:38 -06:00
$amount++;
$this->assertCount(1, Transaction::lessThan($amount)->get());
2015-01-01 06:32:31 -06:00
}
public function testMoreThan()
{
$transaction = f::create('Transaction');
$amount = floatval($transaction->amount);
2015-01-01 15:51:38 -06:00
$amount--;
2015-01-01 06:32:31 -06:00
$this->assertCount(1, Transaction::moreThan($amount)->get());
}
public function testTransactionTypes()
{
$transaction = f::create('Transaction');
$type = $transaction->transactionJournal->transactionType->type;
$this->assertCount(1, Transaction::transactionTypes([$type])->get());
}
2015-01-01 23:16:49 -06:00
}