Make WordPress Core

Changeset 57849


Ignore:
Timestamp:
03/18/2024 09:25:33 AM (2 years ago)
Author:
swissspidy
Message:

Build/Test Tools: Make WP_Filesystem_Direct tests more robust.

Follow-up to [57753] to make tests more robust, as there were multiple permission-related errors in the hosting test results.
With this change, the tests now don’t try setting an owner that doesn’t exist.

Props peterwilsoncc, costdev, javiercasares.
See #57774.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/tests/phpunit/tests/filesystem/wpFilesystemDirect/mkdir.php

    r57753 r57849  
    160160                rmdir( $path );
    161161
    162                 $expected_group = $this->is_windows() ? $original_owner : $original_owner + 1;
    163                 $created        = self::$filesystem->mkdir( $path, 0755, $expected_group );
    164                 $owner          = fileowner( $path );
     162                $created = self::$filesystem->mkdir( $path, 0755, $original_owner );
     163                $owner   = fileowner( $path );
    165164
    166165                if ( $path !== self::$file_structure['test_dir']['path'] && is_dir( $path ) ) {
     
    169168
    170169                $this->assertTrue( $created, 'The directory was not created.' );
    171                 $this->assertSame( $expected_group, $owner, 'The owner is incorrect.' );
     170                $this->assertSame( $original_owner, $owner, 'The owner is incorrect.' );
    172171        }
    173172
     
    198197                rmdir( $path );
    199198
    200                 $expected_group = $this->is_windows() ? $original_group : $original_group + 1;
    201                 $created        = self::$filesystem->mkdir( $path, 0755, false, $expected_group );
    202                 $group          = filegroup( $path );
     199                $created = self::$filesystem->mkdir( $path, 0755, false, $original_group );
     200                $group   = filegroup( $path );
    203201
    204202                if ( $path !== self::$file_structure['test_dir']['path'] && is_dir( $path ) ) {
     
    207205
    208206                $this->assertTrue( $created, 'The directory was not created.' );
    209                 $this->assertSame( $expected_group, $group, 'The group is incorrect.' );
     207                $this->assertSame( $original_group, $group, 'The group is incorrect.' );
    210208        }
    211209}
Note: See TracChangeset for help on using the changeset viewer.