wordpress-develop/tests/phpunit/tests/fonts/font-library/wpFontLibrary/getFontCollection.php
Riad Benguella a770c6da8d REST API: Introduce the necessary endpoints for the font library.
This commits add three endpoints to retrieve and manipulate fonts in WordPress.
This commit also means that we now have a fully functional Font Library in the site editor.

Props get_dave, youknowriad, mmaattiiaass, grantmkin, swissspidy, mcsf, jorbin, ocean90.
See #59166.

git-svn-id: https://develop.svn.wordpress.org/trunk@57548 602fd350-edb4-49c9-b593-d223f7449a82
2024-02-07 09:18:38 +00:00

31 lines
964 B
PHP

<?php
/**
* Test WP_Font_Library::get_font_collections().
*
* @package WordPress
* @subpackage Font Library
*
* @group fonts
* @group font-library
*
* @covers WP_Font_Library::get_font_collection
*/
class Tests_Fonts_WpFontLibrary_GetFontCollection extends WP_Font_Library_UnitTestCase {
public function test_should_get_font_collection() {
$mock_collection_data = array(
'name' => 'Test Collection',
'font_families' => array( 'mock' ),
);
wp_register_font_collection( 'my-font-collection', $mock_collection_data );
$font_collection = WP_Font_Library::get_instance()->get_font_collection( 'my-font-collection' );
$this->assertInstanceOf( 'WP_Font_Collection', $font_collection );
}
public function test_should_get_no_font_collection_if_the_slug_is_not_registered() {
$font_collection = WP_Font_Library::get_instance()->get_font_collection( 'not-registered-font-collection' );
$this->assertNull( $font_collection );
}
}