1<?php
2
3namespace Sabre\CardDAV;
4
5use Sabre\DAVACL;
6
7class AddressBookRootTest extends \PHPUnit_Framework_TestCase {
8
9    function testGetName() {
10
11        $pBackend = new DAVACL\PrincipalBackend\Mock();
12        $cBackend = new Backend\Mock();
13        $root = new AddressBookRoot($pBackend, $cBackend);
14        $this->assertEquals('addressbooks', $root->getName());
15
16    }
17
18    function testGetChildForPrincipal() {
19
20        $pBackend = new DAVACL\PrincipalBackend\Mock();
21        $cBackend = new Backend\Mock();
22        $root = new AddressBookRoot($pBackend, $cBackend);
23
24        $children = $root->getChildren();
25        $this->assertEquals(3, count($children));
26
27        $this->assertInstanceOf('Sabre\\CardDAV\\AddressBookHome', $children[0]);
28        $this->assertEquals('user1', $children[0]->getName());
29
30    }
31}
32