Completed
Pull Request — master (#95)
by
unknown
02:54
created

TransactionTest   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 39
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 2

Importance

Changes 2
Bugs 0 Features 0
Metric Value
wmc 2
c 2
b 0
f 0
lcom 1
cbo 2
dl 0
loc 39
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
B test_getter_and_setter() 0 28 1
A test_get_signed_amount() 0 7 1
1
<?php
2
3
namespace Tests\Fhp\Model\StatementOfAccount;
4
5
use Fhp\Model\StatementOfAccount\Transaction;
6
7
class TransactionTest extends \PHPUnit_Framework_TestCase
8
{
9
    public function test_getter_and_setter()
10
    {
11
        $obj = new Transaction();
12
13
        $this->assertNull($obj->getAccountNumber());
14
        $this->assertNull($obj->getAmount());
15
        $this->assertNull($obj->getBankCode());
16
        $this->assertNull($obj->getBookingDate());
17
        $this->assertNull($obj->getBookingText());
18
        $this->assertNull($obj->getCreditDebit());
19
        $this->assertNull($obj->getDescription1());
20
        $this->assertNull($obj->getDescription2());
21
        $this->assertNull($obj->getName());
22
        $this->assertNull($obj->getValutaDate());
23
24
        $date = new \DateTime();
25
        $this->assertSame('123456789', $obj->setAccountNumber('123456789')->getAccountNumber());
26
        $this->assertSame(20.00, $obj->setAmount(20.00)->getAmount());
27
        $this->assertSame('123456789', $obj->setBankCode('123456789')->getBankCode());
28
        $this->assertSame($date, $obj->setBookingDate($date)->getBookingDate());
29
        $this->assertSame($date, $obj->setValutaDate($date)->getValutaDate());
30
        $this->assertSame('text', $obj->setBookingText('text')->getBookingText());
31
        $this->assertSame(Transaction::CD_DEBIT, $obj->setCreditDebit(Transaction::CD_DEBIT)->getCreditDebit());
32
        $this->assertSame(Transaction::CD_CREDIT, $obj->setCreditDebit(Transaction::CD_CREDIT)->getCreditDebit());
33
        $this->assertSame('desc1', $obj->setDescription1('desc1')->getDescription1());
34
        $this->assertSame('desc2', $obj->setDescription2('desc2')->getDescription2());
35
        $this->assertSame('name', $obj->setName('name')->getName());
36
    }
37
    
38
    public function test_get_signed_amount() {
39
        $obj = new Transaction();
40
        $this->assertSame(-20.00, $obj->setCreditDebit(Transaction::CD_DEBIT)->setAmount(20.00)->getSignedAmount());
41
        $this->assertSame(-20.00, $obj->setCreditDebit(Transaction::CD_CREDIT_CANCELLATION)->setAmount(20.00)->getSignedAmount());
42
        $this->assertSame(20.00, $obj->setCreditDebit(Transaction::CD_CREDIT)->setAmount(20.00)->getSignedAmount());
43
        $this->assertSame(20.00, $obj->setCreditDebit(Transaction::CD_DEBIT_CANCELLATION)->setAmount(20.00)->getSignedAmount());
44
    }
45
}
46