- Timestamp:
- 07/05/2026 12:46:16 AM (4 months ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/tests/phpunit/tests/filesystem/wpFilesystemDirect/chgrp.php
r57753 r62636 30 30 $this->assertFalse( self::$filesystem->chgrp( self::$file_structure['test_dir']['path'] . $path, 0 ) ); 31 31 } 32 33 /** 34 * Tests that recursive {@see WP_Filesystem_Direct::chgrp()} descends into subdirectories. 35 * 36 * The resulting group cannot be asserted without elevated privileges, so recursion is 37 * verified by recording the paths passed to {@see WP_Filesystem_Direct::chgrp()}. Changing each item to its current 38 * group is a permitted no-op that avoids requiring root and its "Operation not permitted" warning. 39 * 40 * @ticket 65584 41 */ 42 public function test_should_recurse_into_subdirectories(): void { 43 $directory = untrailingslashit( self::$file_structure['test_dir']['path'] ); 44 $nested_file = self::$file_structure['subfile']['path']; 45 46 $spy = new class( null ) extends WP_Filesystem_Direct { 47 /** @var string[] */ 48 public array $visited = array(); 49 50 public function chgrp( $file, $group, $recursive = false ) { 51 $this->visited[] = $file; 52 return parent::chgrp( $file, $group, $recursive ); 53 } 54 }; 55 56 $spy->chgrp( $directory, (int) filegroup( $directory ), true ); 57 58 $this->assertContains( 59 $nested_file, 60 $spy->visited, 61 'chgrp() did not recurse into the nested subdirectory.' 62 ); 63 } 32 64 }
Note:
See TracChangeset
for help on using the changeset viewer.