Code
Explorer
You are a developer and looking for Shopware projects?
Apply Now!
getFileGroupId example
$this
->
markAsSkippedIfPosixIsMissing
(
)
;
$infos
=
stat
(
$filepath
)
;
return
$infos
[
'gid'
]
;
}
protected
function
getFileGroup
(
$filepath
)
{
$this
->
markAsSkippedIfPosixIsMissing
(
)
;
if
(
$datas
=
posix_getgrgid
(
$this
->
getFileGroupId
(
$filepath
)
)
)
{
return
$datas
[
'name'
]
;
}
$this
->
markTestSkipped
(
'Unable to retrieve file group name'
)
;
}
protected
function
markAsSkippedIfLinkIsMissing
(
)
{
if
(
!\
function_exists
(
'link'
)
)
{
$this
->
markTestSkipped
(
'link is not supported'
)
;
}
$this
->
assertSame
(
$group
,
$this
->
getFileGroup
(
$dir
)
)
;
}
public
function
testChgrpById
(
)
{
$this
->
markAsSkippedIfPosixIsMissing
(
)
;
$dir
=
$this
->workspace.\DIRECTORY_SEPARATOR.'dir';
mkdir
(
$dir
)
;
$groupId
=
$this
->
getFileGroupId
(
$dir
)
;
$this
->filesystem->
chgrp
(
$dir
,
$groupId
)
;
$this
->
assertSame
(
$groupId
,
$this
->
getFileGroupId
(
$dir
)
)
;
}
public
function
testChgrpRecursive
(
)
{
$this
->
markAsSkippedIfPosixIsMissing
(
)
;
$dir
=
$this
->workspace.\DIRECTORY_SEPARATOR.'dir';
mkdir
(
$dir
)
;