Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Font Library: remove font files created by tests after tests run #54771

Merged
merged 1 commit into from
Sep 26, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,19 @@
*/
abstract class WP_REST_Font_Library_Controller_UnitTestCase extends WP_UnitTestCase {

/**
* Fonts directory.
*
* @var string
*/
protected static $fonts_dir;


public function set_up() {
parent::set_up();

static::$fonts_dir = WP_Font_Library::get_fonts_dir();

// Create a user with administrator role.
$admin_id = $this->factory->user->create(
array(
Expand All @@ -30,5 +40,10 @@ public function tear_down() {
$property = $reflection->getProperty( 'collections' );
$property->setAccessible( true );
$property->setValue( array() );

// Clean up the /fonts directory.
foreach ( $this->files_in_dir( static::$fonts_dir ) as $file ) {
@unlink( $file );
}
}
}
Loading