apply demeter law for transaction type calls

- adds contants for transaction type names
- demeter law = never speaks with strangers
This commit is contained in:
Antonio Spinelli
2015-12-09 22:39:50 -02:00
parent 90e696f82c
commit b3d99cd210
23 changed files with 196 additions and 118 deletions

View File

@@ -1,20 +0,0 @@
<?php
/**
* Class ExampleTest
*/
class ExampleTest extends \PHPUnit_Framework_TestCase
{
protected function setUp()
{
}
protected function tearDown()
{
}
// tests
public function testMe()
{
}
}

View File

@@ -0,0 +1,32 @@
<?php
namespace FireflyIII\Models;
use TestCase;
class TransactionTypeTest extends TestCase
{
public function testIsWithdrawal()
{
$transactionType = TransactionType::whereType(TransactionType::WITHDRAWAL)->first();
$this->assertTrue($transactionType->isWithdrawal());
}
public function testIsDeposit()
{
$transactionType = TransactionType::whereType(TransactionType::DEPOSIT)->first();
$this->assertTrue($transactionType->isDeposit());
}
public function testIsTransfer()
{
$transactionType = TransactionType::whereType(TransactionType::TRANSFER)->first();
$this->assertTrue($transactionType->isTransfer());
}
public function testIsOpeningBalance()
{
$transactionType = TransactionType::whereType(TransactionType::OPENING_BALANCE)->first();
$this->assertTrue($transactionType->isOpeningBalance());
}
}