Skip to content
Merged
Changes from 1 commit
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
fb475a2
remove font collection
matiasbenedetto Sep 21, 2023
a50a2de
add wp_unregister_font_collection function
matiasbenedetto Sep 21, 2023
8b90373
format php
matiasbenedetto Sep 21, 2023
2968267
fix function comment
matiasbenedetto Sep 21, 2023
42a61c5
add tests for unregister_font_collection
matiasbenedetto Sep 21, 2023
27102fa
removig unused variable
matiasbenedetto Sep 21, 2023
da35119
Merge branch 'trunk' into try/unregister-font-collection
matiasbenedetto Oct 10, 2023
7830ff7
update wording on comments
matiasbenedetto Oct 10, 2023
2d6dcd2
Merge branch 'try/unregister-font-collection' of github.com:WordPress…
matiasbenedetto Oct 10, 2023
b7c9113
keep track of unregistered font collection ids in an array
matiasbenedetto Oct 11, 2023
cb28b82
add tests to assure that get_font_collections returns an empty array …
matiasbenedetto Oct 11, 2023
eee0a8d
fix tests
matiasbenedetto Oct 11, 2023
e489991
test the initial empty value of the font library collections
matiasbenedetto Oct 11, 2023
177aa58
format
matiasbenedetto Oct 11, 2023
06a10ea
simplify unregistering of font collections and add _doing_it_wrong call
matiasbenedetto Oct 11, 2023
4d16323
add translation domain
matiasbenedetto Oct 11, 2023
6f2ba86
adding _doing_it_wrong if you are registering collections with the sa…
matiasbenedetto Oct 12, 2023
d9ee03a
updating tests
matiasbenedetto Oct 12, 2023
a07e9fb
replace 6.4.0 by 6.5.0 in comments
matiasbenedetto Oct 12, 2023
e9f7b44
update version
matiasbenedetto Nov 14, 2023
e864318
Merge branch 'trunk' into try/unregister-font-collection
matiasbenedetto Dec 21, 2023
6ca8662
consolidate code as only one function to avoid code repetition
matiasbenedetto Dec 21, 2023
5a2c1ff
create base test case
matiasbenedetto Dec 21, 2023
83525bf
format php
matiasbenedetto Dec 21, 2023
a42fa3f
assertWPError
matiasbenedetto Dec 21, 2023
771e760
check that collection was not unregistered by mistake
matiasbenedetto Dec 21, 2023
5d38c57
calling parent test class mehtods
matiasbenedetto Dec 21, 2023
dcd9770
format php
matiasbenedetto Dec 21, 2023
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
Prev Previous commit
Next Next commit
add tests for unregister_font_collection
  • Loading branch information
matiasbenedetto committed Sep 21, 2023
commit 42a61c57680c42d5bf6c1f58a3c0e89a5b82a5a0
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
<?php
/**
* Test WP_Font_Library::unregister_font_collection().
*
* @package WordPress
* @subpackage Font Library
*
* @group fonts
* @group font-library
*
* @covers WP_Font_Library::unregister_font_collection
*/
class Tests_Fonts_WpFontLibrary_UnregisterFontCollection extends WP_UnitTestCase {

public function set_up() {
$config = array(
'id' => 'mock-col-to-unregister',
'name' => 'Mock Collection to be unregistered',
'description' => 'A mock font collection to be unregistered.',
'data_json_file' => 'my-collection-data.json',
);
$collection = WP_Font_Library::register_font_collection( $config );
}

public function test_should_unregister_font_collection() {
// Unregister mock font collection.
$result1 = WP_Font_Library::unregister_font_collection( 'mock-col-to-unregister' );
$this->assertTrue( $result1, 'Should return true if it was unregistered succesfully.' );
// Try to unregister mock font collection again.
$result2 = WP_Font_Library::unregister_font_collection( 'mock-col-to-unregister' );
$this->assertFalse( $result2, 'Should return false because it was already unregistered.' );
}

public function test_should_unregister_default_font_collection() {
// Unregister default font collection.
$result1 = WP_Font_Library::unregister_font_collection( 'default-font-collection' );
$this->assertTrue( $result1, 'Should return true if it was unregistered succesfully.' );
// Try to unregister default font collection again.
$result2 = WP_Font_Library::unregister_font_collection( 'default-font-collection' );
$this->assertFalse( $result2, 'Should return false because it was already unregistered.' );
}

public function test_should_unregister_non_existing_font_collection() {
// Unregister default font collection.
$result = WP_Font_Library::unregister_font_collection( 'fake-collection-id-x1234' );
$this->assertFalse( $result );
}
}