1 | <?php |
||
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 |