|
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
|
|
|
|