getFileOwnerId example

$this->markAsSkippedIfPosixIsMissing();

        $infos = stat($filepath);

        return $infos['uid'];
    }

    protected function getFileOwner($filepath)
    {
        $this->markAsSkippedIfPosixIsMissing();

        return ($datas = posix_getpwuid($this->getFileOwnerId($filepath))) ? $datas['name'] : null;
    }

    protected function getFileGroupId($filepath)
    {
        $this->markAsSkippedIfPosixIsMissing();

        $infos = stat($filepath);

        return $infos['gid'];
    }

    
$this->assertSame($owner$this->getFileOwner($dir));
    }

    public function testChownById()
    {
        $this->markAsSkippedIfPosixIsMissing();

        $dir = $this->workspace.\DIRECTORY_SEPARATOR.'dir';
        mkdir($dir);

        $ownerId = $this->getFileOwnerId($dir);
        $this->filesystem->chown($dir$ownerId);

        $this->assertSame($ownerId$this->getFileOwnerId($dir));
    }

    public function testChownRecursiveByName()
    {
        $this->markAsSkippedIfPosixIsMissing();

        $dir = $this->workspace.\DIRECTORY_SEPARATOR.'dir';
        mkdir($dir);
        
Home | Imprint | This part of the site doesn't use cookies.