@@ -521,7 +521,7 @@ public function testChmodChangesZeroModeOnSubdirectoriesOnRecursive()
521521 $ this ->assertFilePermissions (753 , $ subdirectory );
522522 }
523523
524- public function testChown ()
524+ public function testChownByName ()
525525 {
526526 $ this ->markAsSkippedIfPosixIsMissing ();
527527
@@ -534,7 +534,20 @@ public function testChown()
534534 $ this ->assertSame ($ owner , $ this ->getFileOwner ($ dir ));
535535 }
536536
537- public function testChownRecursive ()
537+ public function testChownById ()
538+ {
539+ $ this ->markAsSkippedIfPosixIsMissing ();
540+
541+ $ dir = $ this ->workspace .\DIRECTORY_SEPARATOR .'dir ' ;
542+ mkdir ($ dir );
543+
544+ $ ownerId = $ this ->getFileOwnerId ($ dir );
545+ $ this ->filesystem ->chown ($ dir , $ ownerId );
546+
547+ $ this ->assertSame ($ ownerId , $ this ->getFileOwnerId ($ dir ));
548+ }
549+
550+ public function testChownRecursiveByName ()
538551 {
539552 $ this ->markAsSkippedIfPosixIsMissing ();
540553
@@ -549,6 +562,21 @@ public function testChownRecursive()
549562 $ this ->assertSame ($ owner , $ this ->getFileOwner ($ file ));
550563 }
551564
565+ public function testChownRecursiveById ()
566+ {
567+ $ this ->markAsSkippedIfPosixIsMissing ();
568+
569+ $ dir = $ this ->workspace .\DIRECTORY_SEPARATOR .'dir ' ;
570+ mkdir ($ dir );
571+ $ file = $ dir .\DIRECTORY_SEPARATOR .'file ' ;
572+ touch ($ file );
573+
574+ $ ownerId = $ this ->getFileOwnerId ($ dir );
575+ $ this ->filesystem ->chown ($ dir , $ ownerId , true );
576+
577+ $ this ->assertSame ($ ownerId , $ this ->getFileOwnerId ($ file ));
578+ }
579+
552580 public function testChownSymlink ()
553581 {
554582 $ this ->markAsSkippedIfSymlinkIsMissing ();
@@ -624,7 +652,7 @@ public function testChownFail()
624652 $ this ->filesystem ->chown ($ dir , 'user ' .time ().mt_rand (1000 , 9999 ));
625653 }
626654
627- public function testChgrp ()
655+ public function testChgrpByName ()
628656 {
629657 $ this ->markAsSkippedIfPosixIsMissing ();
630658
@@ -637,6 +665,19 @@ public function testChgrp()
637665 $ this ->assertSame ($ group , $ this ->getFileGroup ($ dir ));
638666 }
639667
668+ public function testChgrpById ()
669+ {
670+ $ this ->markAsSkippedIfPosixIsMissing ();
671+
672+ $ dir = $ this ->workspace .\DIRECTORY_SEPARATOR .'dir ' ;
673+ mkdir ($ dir );
674+
675+ $ groupId = $ this ->getFileGroupId ($ dir );
676+ $ this ->filesystem ->chgrp ($ dir , $ groupId );
677+
678+ $ this ->assertSame ($ groupId , $ this ->getFileGroupId ($ dir ));
679+ }
680+
640681 public function testChgrpRecursive ()
641682 {
642683 $ this ->markAsSkippedIfPosixIsMissing ();
@@ -652,7 +693,7 @@ public function testChgrpRecursive()
652693 $ this ->assertSame ($ group , $ this ->getFileGroup ($ file ));
653694 }
654695
655- public function testChgrpSymlink ()
696+ public function testChgrpSymlinkByName ()
656697 {
657698 $ this ->markAsSkippedIfSymlinkIsMissing ();
658699
@@ -669,6 +710,23 @@ public function testChgrpSymlink()
669710 $ this ->assertSame ($ group , $ this ->getFileGroup ($ link ));
670711 }
671712
713+ public function testChgrpSymlinkById ()
714+ {
715+ $ this ->markAsSkippedIfSymlinkIsMissing ();
716+
717+ $ file = $ this ->workspace .\DIRECTORY_SEPARATOR .'file ' ;
718+ $ link = $ this ->workspace .\DIRECTORY_SEPARATOR .'link ' ;
719+
720+ touch ($ file );
721+
722+ $ this ->filesystem ->symlink ($ file , $ link );
723+
724+ $ groupId = $ this ->getFileGroupId ($ link );
725+ $ this ->filesystem ->chgrp ($ link , $ groupId );
726+
727+ $ this ->assertSame ($ groupId , $ this ->getFileGroupId ($ link ));
728+ }
729+
672730 public function testChgrpLink ()
673731 {
674732 $ this ->markAsSkippedIfLinkIsMissing ();
0 commit comments