diff --git a/tests/files/test-vip-filesystem.php b/tests/files/test-vip-filesystem.php index fe0250b45fd..f070fedecc5 100644 --- a/tests/files/test-vip-filesystem.php +++ b/tests/files/test-vip-filesystem.php @@ -4,6 +4,7 @@ use Automattic\Test\Constant_Mocker; use ErrorException; +use Parsely\RemoteAPI\Base_Endpoint_Remote; use WP_Error; use WP_Filesystem_Base; use WP_Filesystem_Direct; @@ -386,4 +387,25 @@ public function data_get_transport_for_path(): iterable { [ constant( 'WP_CONTENT_DIR' ) . '/languages/test.txt', 'direct' ], ]; } + + public function test_wp_font_dir() { + // Only available in WP 6.5 and newer: + if ( ! function_exists( '\wp_get_font_dir' ) ) { + $this->assertEquals( true, true ); + return; + } + // Simulate filter behavior which happens during upload: + add_filter( 'upload_dir', '\wp_get_font_dir' ); + $font_dir = \wp_get_font_dir(); + remove_filter( 'upload_dir', '\zwp_get_font_dir' ); + + $this->assertEquals( $font_dir, [ + 'path' => 'vip://wp-contentt/uploads/fonts', + 'basedir' => 'vip://wp-contentt/uploads/fonts', + 'url' => 'http://example.org/wp-content/uploads/fonts', + 'baseurl' => 'http://example.org/wp-content/uploads/fonts', + 'subdir' => '', + 'error' => false, + ] ); + } }