AnonSec Shell
Server IP : 213.186.33.4  /  Your IP : 216.73.216.193
Web Server : Apache
System : Linux webm006.cluster103.gra.hosting.ovh.net 5.15.206-ovh-vps-grsec-zfs-classid #1 SMP Fri May 15 02:41:25 UTC 2026 x86_64
User : awebpaca ( 35430)
PHP Version : 8.5.0
Disable Function : _dyuweyrj4,_dyuweyrj4r,dl
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : ON  |  Sudo : OFF  |  Pkexec : OFF
Directory :  /home/a/w/e/awebpaca/Dolibarr/htdocs/includes/sabre/sabre/dav/tests/Sabre/DAV/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ HOME ]     

Current File : /home/a/w/e/awebpaca/Dolibarr/htdocs/includes/sabre/sabre/dav/tests/Sabre/DAV//ObjectTreeTest.php
<?php

namespace Sabre\DAV;

require_once 'Sabre/TestUtil.php';

class ObjectTreeTest extends \PHPUnit_Framework_TestCase {

    protected $tree;

    function setup() {

        \Sabre\TestUtil::clearTempDir();
        mkdir(SABRE_TEMPDIR . '/root');
        mkdir(SABRE_TEMPDIR . '/root/subdir');
        file_put_contents(SABRE_TEMPDIR . '/root/file.txt', 'contents');
        file_put_contents(SABRE_TEMPDIR . '/root/subdir/subfile.txt', 'subcontents');
        $rootNode = new FSExt\Directory(SABRE_TEMPDIR . '/root');
        $this->tree = new Tree($rootNode);

    }

    function teardown() {

        \Sabre\TestUtil::clearTempDir();

    }

    function testGetRootNode() {

        $root = $this->tree->getNodeForPath('');
        $this->assertInstanceOf('Sabre\\DAV\\FSExt\\Directory', $root);

    }

    function testGetSubDir() {

        $root = $this->tree->getNodeForPath('subdir');
        $this->assertInstanceOf('Sabre\\DAV\\FSExt\\Directory', $root);

    }

    function testCopyFile() {

       $this->tree->copy('file.txt', 'file2.txt');
       $this->assertTrue(file_exists(SABRE_TEMPDIR . '/root/file2.txt'));
       $this->assertEquals('contents', file_get_contents(SABRE_TEMPDIR . '/root/file2.txt'));

    }

    /**
     * @depends testCopyFile
     */
    function testCopyDirectory() {

       $this->tree->copy('subdir', 'subdir2');
       $this->assertTrue(file_exists(SABRE_TEMPDIR . '/root/subdir2'));
       $this->assertTrue(file_exists(SABRE_TEMPDIR . '/root/subdir2/subfile.txt'));
       $this->assertEquals('subcontents', file_get_contents(SABRE_TEMPDIR . '/root/subdir2/subfile.txt'));

    }

    /**
     * @depends testCopyFile
     */
    function testMoveFile() {

       $this->tree->move('file.txt', 'file2.txt');
       $this->assertTrue(file_exists(SABRE_TEMPDIR . '/root/file2.txt'));
       $this->assertFalse(file_exists(SABRE_TEMPDIR . '/root/file.txt'));
       $this->assertEquals('contents', file_get_contents(SABRE_TEMPDIR . '/root/file2.txt'));

    }

    /**
     * @depends testMoveFile
     */
    function testMoveFileNewParent() {

       $this->tree->move('file.txt', 'subdir/file2.txt');
       $this->assertTrue(file_exists(SABRE_TEMPDIR . '/root/subdir/file2.txt'));
       $this->assertFalse(file_exists(SABRE_TEMPDIR . '/root/file.txt'));
       $this->assertEquals('contents', file_get_contents(SABRE_TEMPDIR . '/root/subdir/file2.txt'));

    }

    /**
     * @depends testCopyDirectory
     */
    function testMoveDirectory() {

       $this->tree->move('subdir', 'subdir2');
       $this->assertTrue(file_exists(SABRE_TEMPDIR . '/root/subdir2'));
       $this->assertTrue(file_exists(SABRE_TEMPDIR . '/root/subdir2/subfile.txt'));
       $this->assertFalse(file_exists(SABRE_TEMPDIR . '/root/subdir'));
       $this->assertEquals('subcontents', file_get_contents(SABRE_TEMPDIR . '/root/subdir2/subfile.txt'));

    }

}

Anon7 - 2022
AnonSec Team