xref: /plugin/davcal/vendor/sabre/dav/tests/Sabre/CardDAV/AddressBookRootTest.php (revision a1a3b6794e0e143a4a8b51d3185ce2d339be61ab)
1*a1a3b679SAndreas Boehler<?php
2*a1a3b679SAndreas Boehler
3*a1a3b679SAndreas Boehlernamespace Sabre\CardDAV;
4*a1a3b679SAndreas Boehler
5*a1a3b679SAndreas Boehleruse Sabre\DAVACL;
6*a1a3b679SAndreas Boehler
7*a1a3b679SAndreas Boehlerclass AddressBookRootTest extends \PHPUnit_Framework_TestCase {
8*a1a3b679SAndreas Boehler
9*a1a3b679SAndreas Boehler    function testGetName() {
10*a1a3b679SAndreas Boehler
11*a1a3b679SAndreas Boehler        $pBackend = new DAVACL\PrincipalBackend\Mock();
12*a1a3b679SAndreas Boehler        $cBackend = new Backend\Mock();
13*a1a3b679SAndreas Boehler        $root = new AddressBookRoot($pBackend, $cBackend);
14*a1a3b679SAndreas Boehler        $this->assertEquals('addressbooks', $root->getName());
15*a1a3b679SAndreas Boehler
16*a1a3b679SAndreas Boehler    }
17*a1a3b679SAndreas Boehler
18*a1a3b679SAndreas Boehler    function testGetChildForPrincipal() {
19*a1a3b679SAndreas Boehler
20*a1a3b679SAndreas Boehler        $pBackend = new DAVACL\PrincipalBackend\Mock();
21*a1a3b679SAndreas Boehler        $cBackend = new Backend\Mock();
22*a1a3b679SAndreas Boehler        $root = new AddressBookRoot($pBackend, $cBackend);
23*a1a3b679SAndreas Boehler
24*a1a3b679SAndreas Boehler        $children = $root->getChildren();
25*a1a3b679SAndreas Boehler        $this->assertEquals(3, count($children));
26*a1a3b679SAndreas Boehler
27*a1a3b679SAndreas Boehler        $this->assertInstanceOf('Sabre\\CardDAV\\AddressBookHome', $children[0]);
28*a1a3b679SAndreas Boehler        $this->assertEquals('user1', $children[0]->getName());
29*a1a3b679SAndreas Boehler
30*a1a3b679SAndreas Boehler    }
31*a1a3b679SAndreas Boehler}
32