Completed
Pull Request — develop (#48)
by Luís
02:58 queued 50s
created

ChargeTest   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 44
Duplicated Lines 0 %

Coupling/Cohesion

Components 2
Dependencies 2

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 4
c 1
b 0
f 0
lcom 2
cbo 2
dl 0
loc 44
rs 10
1
<?php
2
namespace PHPSC\PagSeguro\Purchases\Subscriptions;
3
4
use PHPSC\PagSeguro\Items\ItemCollection;
5
6
/**
7
 * @author Adelar Tiemann Junior <[email protected]>       
8
 */
9
class ChargeTest extends \PHPUnit_Framework_TestCase
10
{
11
    /**
12
     * @var Charge
13
     */
14
    private $charge;
15
16
    protected function setUp()
17
    {
18
        $this->charge = new Charge();
19
    }
20
21
    /**
22
     * @test
23
     */
24
    public function constructShouldConfigureTheAttributes()
25
    {
26
        $this->assertInstanceOf(ItemCollection::class, $this->charge->getItems());
27
    }
28
29
    /**
30
     * @test
31
     */
32
    public function setReferenceShouldConfigureTheReference()
33
    {
34
        $charge = new Charge();
35
        $charge->setReference('SomeRef');
36
        
37
        $this->assertAttributeEquals('SomeRef', 'reference', $charge);
38
        $this->assertEquals('SomeRef', $charge->getReference());
39
    }
40
41
    /**
42
     * @test
43
     */
44
    public function setSubscriptionCodeShouldConfigureTheSubscriptionCode()
45
    {
46
        $charge = new Charge();
47
        $charge->setSubscriptionCode('SomeSubscription');
48
        
49
        $this->assertAttributeEquals('SomeSubscription', 'subscriptionCode', $charge);
50
        $this->assertEquals('SomeSubscription', $charge->getSubscriptionCode());
51
    }
52
}
53