In the example below, the uid is set correctly to 1234, but the gid remains 1000 (my current user Linux.)
In production this particular script gets to run as root, so it works flawlessly there. But I want to be able to test it using vfsStream.
There seems to be no way to tell vfsStream to mimic the root user, and I'm puzzled why chown works, but chgrp doesn't.
$structure = [
'etc' => [],
];
$root = vfsStream::setup('root', null, $structure);
$directory = $root->url() . '/etc/test';
mkdir($directory);
chown($directory, 1234);
chgrp($directory, 1234);
clearstatcache();
dd(stat($directory));