Passed
Push — develop ( 19a8b8...726e4d )
by Luís
29s
created

PhoneTest   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 40
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 2

Importance

Changes 2
Bugs 0 Features 0
Metric Value
wmc 3
c 2
b 0
f 0
lcom 1
cbo 2
dl 0
loc 40
rs 10
1
<?php
2
namespace PHPSC\PagSeguro\Customer;
3
4
class PhoneTest extends \PHPUnit_Framework_TestCase
5
{
6
    /**
7
     * @test
8
     */
9
    public function constructMustTruncateData()
10
    {
11
        $phone = new Phone(479, 1234567890);
12
13
        $this->assertAttributeEquals(479, 'areaCode', $phone);
14
        $this->assertAttributeEquals(1234567890, 'number', $phone);
15
    }
16
17
    /**
18
     * @test
19
     */
20
    public function gettersShouldReturnConfiguredData()
21
    {
22
        $phone = new Phone(47, 98761234);
23
24
        $this->assertEquals(47, $phone->getAreaCode());
25
        $this->assertEquals(98761234, $phone->getNumber());
26
    }
27
28
    /**
29
     * @test
30
     */
31
    public function xmlSerializeMustAppendFormattedPhoneData()
32
    {
33
        $this->markTestSkipped();
34
35
        $xml = simplexml_load_string('<?xml version="1.0" encoding="UTF-8"?><test />');
36
37
        $phone = new Phone(479, 1234567890);
38
        $phone->xmlSerialize($xml);
39
40
        $this->assertEquals(47, (string) $xml->phone->areaCode);
41
        $this->assertEquals(123456789, (string) $xml->phone->number);
42
    }
43
}
44