Changeset 51186
- Timestamp:
- 06/20/2021 12:24:31 AM (4 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/tests/phpunit/tests/multisite/cleanDirsizeCache.php
r49744 r51186 66 66 67 67 // No cache match on non existing directory should return false. 68 $this->assert Same( false,recurse_dirsize( $upload_dir['basedir'] . '/does_not_exist' ) );68 $this->assertFalse( recurse_dirsize( $upload_dir['basedir'] . '/does_not_exist' ) ); 69 69 70 70 // Cleanup. … … 102 102 set_transient( 'dirsize_cache', $this->_get_mock_dirsize_cache_for_site( $blog_id ) ); 103 103 104 $this->assert Same( true, array_key_exists( $cache_key_prefix . '/1/1', get_transient( 'dirsize_cache' )) );105 $this->assert Same( true, array_key_exists( $cache_key_prefix . '/2/1', get_transient( 'dirsize_cache' )) );106 $this->assert Same( true, array_key_exists( $cache_key_prefix . '/2', get_transient( 'dirsize_cache' )) );104 $this->assertArrayHasKey( $cache_key_prefix . '/1/1', get_transient( 'dirsize_cache' ) ); 105 $this->assertArrayHasKey( $cache_key_prefix . '/2/1', get_transient( 'dirsize_cache' ) ); 106 $this->assertArrayHasKey( $cache_key_prefix . '/2', get_transient( 'dirsize_cache' ) ); 107 107 108 108 // Invalidation should also respect the directory tree up. … … 110 110 clean_dirsize_cache( $upload_dir['basedir'] . '/2/1/file.dummy' ); 111 111 112 $this->assert Same( false, array_key_exists( $cache_key_prefix . '/2/1', get_transient( 'dirsize_cache' )) );113 $this->assert Same( false, array_key_exists( $cache_key_prefix . '/2', get_transient( 'dirsize_cache' )) );112 $this->assertArrayNotHasKey( $cache_key_prefix . '/2/1', get_transient( 'dirsize_cache' ) ); 113 $this->assertArrayNotHasKey( $cache_key_prefix . '/2', get_transient( 'dirsize_cache' ) ); 114 114 115 115 // Other cache paths should not be invalidated. 116 $this->assert Same( true, array_key_exists( $cache_key_prefix . '/1/1', get_transient( 'dirsize_cache' )) );116 $this->assertArrayHasKey( $cache_key_prefix . '/1/1', get_transient( 'dirsize_cache' ) ); 117 117 118 118 // Cleanup. … … 150 150 set_transient( 'dirsize_cache', $this->_get_mock_dirsize_cache_for_site( $blog_id ) ); 151 151 152 $this->assert Same( true, array_key_exists( $cache_key_prefix . '/1/1', get_transient( 'dirsize_cache' )) );153 $this->assert Same( true, array_key_exists( $cache_key_prefix . '/2/1', get_transient( 'dirsize_cache' )) );154 $this->assert Same( true, array_key_exists( $cache_key_prefix . '/2', get_transient( 'dirsize_cache' )) );152 $this->assertArrayHasKey( $cache_key_prefix . '/1/1', get_transient( 'dirsize_cache' ) ); 153 $this->assertArrayHasKey( $cache_key_prefix . '/2/1', get_transient( 'dirsize_cache' ) ); 154 $this->assertArrayHasKey( $cache_key_prefix . '/2', get_transient( 'dirsize_cache' ) ); 155 155 156 156 // Invalidation should also respect the directory tree up. … … 158 158 clean_dirsize_cache( $upload_dir['basedir'] . '/2/1' ); 159 159 160 $this->assert Same( false, array_key_exists( $cache_key_prefix . '/2/1', get_transient( 'dirsize_cache' )) );161 $this->assert Same( false, array_key_exists( $cache_key_prefix . '/2', get_transient( 'dirsize_cache' )) );160 $this->assertArrayNotHasKey( $cache_key_prefix . '/2/1', get_transient( 'dirsize_cache' ) ); 161 $this->assertArrayNotHasKey( $cache_key_prefix . '/2', get_transient( 'dirsize_cache' ) ); 162 162 163 163 // Other cache paths should not be invalidated. 164 $this->assert Same( true, array_key_exists( $cache_key_prefix . '/1/1', get_transient( 'dirsize_cache' )) );164 $this->assertArrayHasKey( $cache_key_prefix . '/1/1', get_transient( 'dirsize_cache' ) ); 165 165 166 166 // Cleanup. … … 207 207 // `dirsize_cache` should now be filled after upload and recurse_dirsize() call. 208 208 $cache_path = untrailingslashit( $upload_dir['path'] ); 209 $this->assert Same( true, is_array( get_transient( 'dirsize_cache' )) );209 $this->assertInternalType( 'array', get_transient( 'dirsize_cache' ) ); 210 210 $this->assertSame( $size, get_transient( 'dirsize_cache' )[ $cache_path ] ); 211 211 … … 281 281 * exist on disk, so the function should fail. 282 282 */ 283 $this->assert Same( false,recurse_dirsize( $upload_dir['basedir'] . '/2/1' ) );283 $this->assertFalse( recurse_dirsize( $upload_dir['basedir'] . '/2/1' ) ); 284 284 285 285 /* … … 305 305 306 306 // No cache match on non existing directory should return false. 307 $this->assert Same( false,recurse_dirsize( $upload_dir['basedir'] . '/does_not_exist' ) );307 $this->assertFalse( recurse_dirsize( $upload_dir['basedir'] . '/does_not_exist' ) ); 308 308 309 309 // Cleanup.
Note: See TracChangeset
for help on using the changeset viewer.