File tree Expand file tree Collapse file tree
tests/phpunit/tests/fonts/font-library/wpFontUtils Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ <?php
2+ /**
3+ * Test WP_Font_Utils::normalize_css_font_face_font_family().
4+ *
5+ * @package WordPress
6+ * @subpackage Font Library
7+ *
8+ * @group fonts
9+ * @group font-library
10+ *
11+ * @covers WP_Font_Utils::normalize_css_font_face_font_family
12+ */
13+ class Tests_Fonts_WpFontUtils_normalizeCssFontFaceFontFamily extends WP_UnitTestCase {
14+ /**
15+ * @ticket TBD
16+ *
17+ * @dataProvider data_provider
18+ */
19+ public function test_normalize_css_font_face_font_family ( string $ input , ?string $ expected ): void {
20+ $ result = WP_Font_Utils::normalize_css_font_face_font_family ( $ input );
21+ $ this ->assertSame ( $ expected , $ result );
22+
23+ // Idempotency check.
24+ if ( null !== $ result ) {
25+ $ this ->assertSame ( $ result , WP_Font_Utils::normalize_css_font_face_font_family ( $ result ) );
26+ }
27+ }
28+
29+ /**
30+ * Data provider.
31+ */
32+ public static function data_provider (): Generator {
33+ yield 'Already normalized ' => array ( '"Font" ' , '"Font" ' );
34+ yield 'Unquoted ' => array ( 'Font ' , '"Font" ' );
35+ yield 'Multiple idents ' => array ( 'Font Name ' , '"Font Name" ' );
36+ yield 'Unitless number? ' => array ( 'Libre Barcode 128 Text ' , null );
37+ yield 'Unitful number? ' => array ( '10px Size ' , null );
38+ }
39+ }
You can’t perform that action at this time.
0 commit comments