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