Skip to content
Open
Show file tree
Hide file tree
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
9 changes: 9 additions & 0 deletions tests/phpunit/tests/fonts/font-library/fontLibraryHooks.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,15 @@
*/
class Tests_Fonts_FontLibraryHooks extends WP_UnitTestCase {

/**
* Tear down the test fixture.
*/
public function tear_down() {
// Remove all fonts uploaded during the tests.
$this->remove_added_uploads();
parent::tear_down();
}

public function test_deleting_font_family_deletes_child_font_faces() {
$font_family_id = self::factory()->post->create(
array(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -461,6 +461,9 @@ function ( $font_dir ) {
// Delete the post.
wp_delete_post( $data['id'], true );
$this->assertFileDoesNotExist( $expected_file_path, 'The font file should have been deleted when the post was deleted.' );

// Clean up: Delete the subdir test directory.
rmdir( WP_CONTENT_DIR . '/uploads/fonts/subdir' );
}

/**
Expand Down
9 changes: 8 additions & 1 deletion tests/phpunit/tests/user/getActiveBlogForUser.php
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,14 @@ public function test_get_active_blog_for_user_without_primary_site() {

$result = get_active_blog_for_user( self::$user_id );

wp_delete_site( $primary_site_id );
/*
* Avoid using wp_delete_site() here because it will delete the uploads
* directory without checking if the site is the main one. Otherwise,
* when this test runs in a single site environment (e.g. when running
* grunt precommit), it will delete the entire contents of the uploads
* directory, which we want to avoid.
*/
wpmu_delete_blog( $primary_site_id, true );

$this->assertSame( $primary_site_id, $result->id );
}
Expand Down
Loading