Skip to content

Commit

Permalink
Add unit test
Browse files Browse the repository at this point in the history
  • Loading branch information
noahtallen committed Feb 27, 2024
1 parent b975596 commit ee31043
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions tests/files/test-vip-filesystem.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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,
] );
}
}

0 comments on commit ee31043

Please sign in to comment.