Code
Explorer
You are a developer and looking for Shopware projects?
Apply Now!
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
)
;