Skip to content

Commit

Permalink
Improve texts
Browse files Browse the repository at this point in the history
Co-authored-by: Brian Alexander <824344+ironprogrammer@users.noreply.github.com>
  • Loading branch information
matiasbenedetto and ironprogrammer authored Mar 14, 2024
1 parent 5f7b3d1 commit de55afb
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions tests/phpunit/tests/fonts/font-library/wpFontsDir.php
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ function set_new_values( $defaults ) {
$this->assertSame( static::$dir_defaults, $font_dir, 'The wp_get_font_dir() method should return the default values.' );
}

public function test_should_created_fonts_dir_in_uploads_when_fails_in_wp_content() {
public function test_should_create_fonts_dir_in_uploads_when_fails_in_wp_content() {
// Set the expected results.
$upload_dir = wp_upload_dir();
$path = path_join( $upload_dir['basedir'], 'fonts' );
Expand All @@ -100,8 +100,8 @@ public function test_should_created_fonts_dir_in_uploads_when_fails_in_wp_conten

$font_dir = wp_get_font_dir();

$this->assertDirectoryDoesNotExist( path_join( WP_CONTENT_DIR, 'fonts' ), 'The `wp-content/fonts` directory should not exist' );
$this->assertDirectoryExists( $font_dir['path'], 'The `uploads/fonts` directory should exist' );
$this->assertDirectoryDoesNotExist( path_join( WP_CONTENT_DIR, 'fonts' ), 'The `wp-content/fonts` directory should not exist.' );
$this->assertDirectoryExists( $font_dir['path'], 'The `uploads/fonts` directory should exist.' );
$this->assertSame( $expected, $font_dir, 'The font directory should be a subdir in the uploads directory.' );
}

Expand All @@ -122,6 +122,10 @@ private function remove_fonts_directory() {
}
}

/**
* A placeholder "fake" file at `wp-content/fonts` triggers `wp_mkdir_p()` to fail into the `file_exists()` bail out, causing `is_dir()` to return `false`.
* This effectively makes `wp-content/fonts` unwritable as the default `fonts` directory location.
*/
private function fake_no_new_directories_in_wp_content() {
file_put_contents(
self::$fake_fonts_file,
Expand Down

0 comments on commit de55afb

Please sign in to comment.