AddressBookTest   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 26
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 7

Importance

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

2 Methods

Rating   Name   Duplication   Size   Complexity  
A testAddressBook() 0 11 1
A testView() 0 9 1
1
<?php
2
/**
3
 * Grandstream-XMLApp
4
 *
5
 * Copyright (c) 2017 pudelek.org.pl
6
 *
7
 * @license MIT License (MIT)
8
 *
9
 * For the full copyright and license information, please view source file
10
 * that is bundled with this package in the file LICENSE
11
 *
12
 * @author Marcin Pudełek <[email protected]>
13
 */
14
15
namespace mrcnpdlk\Grandstream\XMLApp;
16
17
use mrcnpdlk\Grandstream\XMLApp\AddressBook\AddressBook;
18
use mrcnpdlk\Grandstream\XMLApp\AddressBook\Model\Address;
19
use mrcnpdlk\Grandstream\XMLApp\AddressBook\Model\Contact;
20
use mrcnpdlk\Grandstream\XMLApp\AddressBook\Model\Phone;
21
use mrcnpdlk\Grandstream\XMLApp\AddressBook\View;
22
23
class AddressBookTest extends TestCase
24
{
25
26
    public function testAddressBook()
27
    {
28
        $oPhone   = new Phone('123', 1);
29
        $oContact = new Contact('sss', $oPhone);
30
        $oAddress = new Address('ul. Krucza');
31
        $oContact->setAddress($oAddress);
32
        $oAddressBook = new AddressBook();
33
        $oAddressBook->addContact($oContact)->addContact($oContact);
34
35
        $this->assertEquals(true, is_string($oAddressBook->getXml()->asText()));
36
    }
37
38
    public function testView(){
39
        $oView = new View();
40
41
        $oView->addContact('Doe', '123123123', 'John');
42
        $oView->addContact('Nowak', '456456456');
43
44
        $this->assertEquals(true, is_string($oView->asTxt()));
45
46
    }
47
48
}
49