1<?php
2
3namespace Sabre\DAVACL\FS;
4
5class CollectionTest extends FileTest {
6
7    function setUp() {
8
9        $this->path = SABRE_TEMPDIR;
10        $this->sut = new Collection($this->path, $this->acl, $this->owner);
11
12    }
13
14    function tearDown() {
15
16        \Sabre\TestUtil::clearTempDir();
17
18    }
19
20    function testGetChildFile() {
21
22        file_put_contents(SABRE_TEMPDIR . '/file.txt', 'hello');
23        $child = $this->sut->getChild('file.txt');
24        $this->assertInstanceOf('Sabre\\DAVACL\\FS\\File', $child);
25
26        $this->assertEquals('file.txt', $child->getName());
27        $this->assertEquals($this->acl, $child->getACL());
28        $this->assertEquals($this->owner, $child->getOwner());
29
30    }
31
32    function testGetChildDirectory() {
33
34        mkdir(SABRE_TEMPDIR . '/dir');
35        $child = $this->sut->getChild('dir');
36        $this->assertInstanceOf('Sabre\\DAVACL\\FS\\Collection', $child);
37
38        $this->assertEquals('dir', $child->getName());
39        $this->assertEquals($this->acl, $child->getACL());
40        $this->assertEquals($this->owner, $child->getOwner());
41
42    }
43
44}
45