Skip to content

Commit

Permalink
Update test, remove mock data
Browse files Browse the repository at this point in the history
  • Loading branch information
Khadreal committed Feb 21, 2025
1 parent 9474498 commit daa4504
Show file tree
Hide file tree
Showing 9 changed files with 9 additions and 109 deletions.
102 changes: 1 addition & 101 deletions inc/Engine/Media/PreloadFonts/Frontend/Controller.php
Original file line number Diff line number Diff line change
Expand Up @@ -107,112 +107,12 @@ public function add_custom_data( array $data ): array {
*/
$system_fonts = wpm_apply_filters_typed( 'array', 'rocket_preload_fonts_system_fonts', $system_fonts );

// To Delete Mock Data during implementation of https://github.com/wp-media/wp-rocket/issues/7306.
$font_data = [
'https://fonts.gstatic.com/s/poppins/v22/pxiAyp8kv8JHgFVrJJLmE0tMMPKhSkFEkm8.woff2' => [
[
'family' => 'Poppins',
'weight' => '100',
'style' => 'italic',
'unicodeRange' => 'U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7…',
],
],
'https://fonts.gstatic.com/s/poppins/v22/pxiAyp8kv8JHgFVrJJLmE0tCMPKhSkFE.woff2' => [
[
'family' => 'Poppins',
'weight' => '100',
'style' => 'italic',
'unicodeRange' => 'U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC…',
],
],
'https://fonts.gstatic.com/s/poppins/v22/pxiDyp8kv8JHgFVrJJLmv1pVGdeOYktMqlap.woff2' => [
[
'family' => 'Poppins',
'weight' => '200',
'style' => 'italic',
'unicodeRange' => 'U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7…',
],
],
'https://fonts.gstatic.com/s/poppins/v22/pxiDyp8kv8JHgFVrJJLmv1pVF9eOYktMqg.woff2' => [
[
'family' => 'Poppins',
'weight' => '200',
'style' => 'italic',
'unicodeRange' => 'U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC…',
],
],
'https://fonts.gstatic.com/s/poppins/v22/pxiDyp8kv8JHgFVrJJLm21lVGdeOYktMqlap.woff2' => [
[
'family' => 'Poppins',
'weight' => '300',
'style' => 'italic',
'unicodeRange' => 'U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7…',
],
],
'https://fonts.gstatic.com/s/poppins/v22/pxiDyp8kv8JHgFVrJJLm21lVF9eOYktMqg.woff2' => [
[
'family' => 'Poppins',
'weight' => '300',
'style' => 'italic',
'unicodeRange' => 'U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC…',
],
],
'https://fonts.gstatic.com/s/poppins/v22/pxiEyp8kv8JHgFVrJJLmg1hHGpeKQEk.woff2' => [
[
'family' => 'Poppins',
'weight' => '400',
'style' => 'italic',
'unicodeRange' => 'U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC…',
],
],
'https://fonts.gstatic.com/s/poppins/v22/pxiFyp8kv8JHgFVrJJLucHtUFMNEKQ.woff2' => [
[
'family' => 'Poppins',
'weight' => '500',
'style' => 'italic',
'unicodeRange' => 'U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC…',
],
],
'https://fonts.gstatic.com/s/poppins/v22/pxiGyp8kv8JHgFVrJJLsbX9NE9eO.woff2' => [
[
'family' => 'Poppins',
'weight' => '600',
'style' => 'italic',
'unicodeRange' => 'U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC…',
],
],
'https://fonts.gstatic.com/s/poppins/v22/pxiGyp8kv8JHgFVrJJLsbXpNE9eO.woff2' => [
[
'family' => 'Poppins',
'weight' => '900',
'style' => 'italic',
'unicodeRange' => 'U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC…',
],
],
'https://fonts.gstatic.com/s/poppins/v22/pxiGyp8kv8JHgFVrLPTufntAOvWDSHFF.woff2' => [
[
'family' => 'Poppins',
'weight' => '100',
'style' => 'normal',
'unicodeRange' => 'U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7…',
],
],
'https://fonts.cdnfonts.com/s/31427/Paper Sign.woff' => [
[
'family' => 'Paper Sign',
'weight' => '400',
'style' => 'normal',
'unicodeRange' => 'U+0000-10FFFF',
],
],
];

/**
* Filters the list of mock font urls.
*
* @param array $font_data Array of font data.
*/
$font_data = wpm_apply_filters_typed( 'array', 'rocket_preload_fonts_font_data', $font_data );
$font_data = wpm_apply_filters_typed( 'array', 'rocket_preload_fonts_font_data', [] );

$data['system_fonts'] = $system_fonts;
$data['font_data'] = $font_data;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,5 @@
</head>
<body>
</html>
<script>var rocket_beacon_data = {"ajax_url":"http:\/\/example.org\/wp-admin\/admin-ajax.php","nonce":"96ac96b69e","url":"http:\/\/example.org","is_mobile":false,"width_threshold":1600,"height_threshold":700,"delay":500,"debug":false,"status":{"atf":true,"lrc":true,"preload_fonts":true},"elements":"img, video, picture, p, main, div, li, svg, section, header, span","lrc_threshold":1800,"system_fonts":["serif","sans-serif","monospace","cursive","fantasy","system-ui","ui-serif","ui-sans-serif","ui-monospace","ui-rounded","Arial","Helvetica","Times New Roman","Times","Courier New","Courier","Georgia","Palatino","Garamond","Bookman","Tahoma","Trebuchet MS","Arial Black","Impact","Comic Sans MS"],"font_data":{"https:\/\/fonts.gstatic.com\/s\/poppins\/v22\/pxiAyp8kv8JHgFVrJJLmE0tMMPKhSkFEkm8.woff2":[{"family":"Poppins","weight":"100","style":"italic","unicodeRange":"U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7\u2026"}],"https:\/\/fonts.gstatic.com\/s\/poppins\/v22\/pxiAyp8kv8JHgFVrJJLmE0tCMPKhSkFE.woff2":[{"family":"Poppins","weight":"100","style":"italic","unicodeRange":"U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC\u2026"}],"https:\/\/fonts.gstatic.com\/s\/poppins\/v22\/pxiDyp8kv8JHgFVrJJLmv1pVGdeOYktMqlap.woff2":[{"family":"Poppins","weight":"200","style":"italic","unicodeRange":"U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7\u2026"}],"https:\/\/fonts.gstatic.com\/s\/poppins\/v22\/pxiDyp8kv8JHgFVrJJLmv1pVF9eOYktMqg.woff2":[{"family":"Poppins","weight":"200","style":"italic","unicodeRange":"U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC\u2026"}],"https:\/\/fonts.gstatic.com\/s\/poppins\/v22\/pxiDyp8kv8JHgFVrJJLm21lVGdeOYktMqlap.woff2":[{"family":"Poppins","weight":"300","style":"italic","unicodeRange":"U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7\u2026"}],"https:\/\/fonts.gstatic.com\/s\/poppins\/v22\/pxiDyp8kv8JHgFVrJJLm21lVF9eOYktMqg.woff2":[{"family":"Poppins","weight":"300","style":"italic","unicodeRange":"U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC\u2026"}],"https:\/\/fonts.gstatic.com\/s\/poppins\/v22\/pxiEyp8kv8JHgFVrJJLmg1hHGpeKQEk.woff2":[{"family":"Poppins","weight":"400","style":"italic","unicodeRange":"U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC\u2026"}],"https:\/\/fonts.gstatic.com\/s\/poppins\/v22\/pxiFyp8kv8JHgFVrJJLucHtUFMNEKQ.woff2":[{"family":"Poppins","weight":"500","style":"italic","unicodeRange":"U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC\u2026"}],"https:\/\/fonts.gstatic.com\/s\/poppins\/v22\/pxiGyp8kv8JHgFVrJJLsbX9NE9eO.woff2":[{"family":"Poppins","weight":"600","style":"italic","unicodeRange":"U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC\u2026"}],"https:\/\/fonts.gstatic.com\/s\/poppins\/v22\/pxiGyp8kv8JHgFVrJJLsbXpNE9eO.woff2":[{"family":"Poppins","weight":"900","style":"italic","unicodeRange":"U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC\u2026"}],"https:\/\/fonts.gstatic.com\/s\/poppins\/v22\/pxiGyp8kv8JHgFVrLPTufntAOvWDSHFF.woff2":[{"family":"Poppins","weight":"100","style":"normal","unicodeRange":"U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7\u2026"}],"https:\/\/fonts.cdnfonts.com\/s\/31427\/Paper Sign.woff":[{"family":"Paper Sign","weight":"400","style":"normal","unicodeRange":"U+0000-10FFFF"}]}}</script><script data-name="wpr-wpr-beacon" src='http://example.org/wp-content/plugins/wp-rocket/assets/js/wpr-beacon.min.js' async></script>
<script>var rocket_beacon_data = {"ajax_url":"http:\/\/example.org\/wp-admin\/admin-ajax.php","nonce":"96ac96b69e","url":"http:\/\/example.org","is_mobile":false,"width_threshold":1600,"height_threshold":700,"delay":500,"debug":false,"status":{"atf":true,"lrc":true,"preload_fonts":true},"elements":"img, video, picture, p, main, div, li, svg, section, header, span","lrc_threshold":1800,"system_fonts":["serif","sans-serif","monospace","cursive","fantasy","system-ui","ui-serif","ui-sans-serif","ui-monospace","ui-rounded","Arial","Helvetica","Times New Roman","Times","Courier New","Courier","Georgia","Palatino","Garamond","Bookman","Tahoma","Trebuchet MS","Arial Black","Impact","Comic Sans MS"],"font_data":[]}</script><script data-name="wpr-wpr-beacon" src='http://example.org/wp-content/plugins/wp-rocket/assets/js/wpr-beacon.min.js' async></script>

Original file line number Diff line number Diff line change
Expand Up @@ -18,5 +18,5 @@ <h1>Iframe Header</h1>
</body>
</html>
" width="600" height="400" style="border:none;"></iframe>
<script>var rocket_beacon_data = {"ajax_url":"http:\/\/example.org\/wp-admin\/admin-ajax.php","nonce":"96ac96b69e","url":"http:\/\/example.org","is_mobile":false,"width_threshold":1600,"height_threshold":700,"delay":500,"debug":false,"status":{"atf":true,"lrc":true,"preload_fonts":true},"elements":"img, video, picture, p, main, div, li, svg, section, header, span","lrc_threshold":1800,"system_fonts":["serif","sans-serif","monospace","cursive","fantasy","system-ui","ui-serif","ui-sans-serif","ui-monospace","ui-rounded","Arial","Helvetica","Times New Roman","Times","Courier New","Courier","Georgia","Palatino","Garamond","Bookman","Tahoma","Trebuchet MS","Arial Black","Impact","Comic Sans MS"],"font_data":{"https:\/\/fonts.gstatic.com\/s\/poppins\/v22\/pxiAyp8kv8JHgFVrJJLmE0tMMPKhSkFEkm8.woff2":[{"family":"Poppins","weight":"100","style":"italic","unicodeRange":"U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7\u2026"}],"https:\/\/fonts.gstatic.com\/s\/poppins\/v22\/pxiAyp8kv8JHgFVrJJLmE0tCMPKhSkFE.woff2":[{"family":"Poppins","weight":"100","style":"italic","unicodeRange":"U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC\u2026"}],"https:\/\/fonts.gstatic.com\/s\/poppins\/v22\/pxiDyp8kv8JHgFVrJJLmv1pVGdeOYktMqlap.woff2":[{"family":"Poppins","weight":"200","style":"italic","unicodeRange":"U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7\u2026"}],"https:\/\/fonts.gstatic.com\/s\/poppins\/v22\/pxiDyp8kv8JHgFVrJJLmv1pVF9eOYktMqg.woff2":[{"family":"Poppins","weight":"200","style":"italic","unicodeRange":"U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC\u2026"}],"https:\/\/fonts.gstatic.com\/s\/poppins\/v22\/pxiDyp8kv8JHgFVrJJLm21lVGdeOYktMqlap.woff2":[{"family":"Poppins","weight":"300","style":"italic","unicodeRange":"U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7\u2026"}],"https:\/\/fonts.gstatic.com\/s\/poppins\/v22\/pxiDyp8kv8JHgFVrJJLm21lVF9eOYktMqg.woff2":[{"family":"Poppins","weight":"300","style":"italic","unicodeRange":"U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC\u2026"}],"https:\/\/fonts.gstatic.com\/s\/poppins\/v22\/pxiEyp8kv8JHgFVrJJLmg1hHGpeKQEk.woff2":[{"family":"Poppins","weight":"400","style":"italic","unicodeRange":"U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC\u2026"}],"https:\/\/fonts.gstatic.com\/s\/poppins\/v22\/pxiFyp8kv8JHgFVrJJLucHtUFMNEKQ.woff2":[{"family":"Poppins","weight":"500","style":"italic","unicodeRange":"U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC\u2026"}],"https:\/\/fonts.gstatic.com\/s\/poppins\/v22\/pxiGyp8kv8JHgFVrJJLsbX9NE9eO.woff2":[{"family":"Poppins","weight":"600","style":"italic","unicodeRange":"U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC\u2026"}],"https:\/\/fonts.gstatic.com\/s\/poppins\/v22\/pxiGyp8kv8JHgFVrJJLsbXpNE9eO.woff2":[{"family":"Poppins","weight":"900","style":"italic","unicodeRange":"U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC\u2026"}],"https:\/\/fonts.gstatic.com\/s\/poppins\/v22\/pxiGyp8kv8JHgFVrLPTufntAOvWDSHFF.woff2":[{"family":"Poppins","weight":"100","style":"normal","unicodeRange":"U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7\u2026"}],"https:\/\/fonts.cdnfonts.com\/s\/31427\/Paper Sign.woff":[{"family":"Paper Sign","weight":"400","style":"normal","unicodeRange":"U+0000-10FFFF"}]}}</script><script data-name="wpr-wpr-beacon" src='http://example.org/wp-content/plugins/wp-rocket/assets/js/wpr-beacon.min.js' async></script></body>
<script>var rocket_beacon_data = {"ajax_url":"http:\/\/example.org\/wp-admin\/admin-ajax.php","nonce":"96ac96b69e","url":"http:\/\/example.org","is_mobile":false,"width_threshold":1600,"height_threshold":700,"delay":500,"debug":false,"status":{"atf":true,"lrc":true,"preload_fonts":true},"elements":"img, video, picture, p, main, div, li, svg, section, header, span","lrc_threshold":1800,"system_fonts":["serif","sans-serif","monospace","cursive","fantasy","system-ui","ui-serif","ui-sans-serif","ui-monospace","ui-rounded","Arial","Helvetica","Times New Roman","Times","Courier New","Courier","Georgia","Palatino","Garamond","Bookman","Tahoma","Trebuchet MS","Arial Black","Impact","Comic Sans MS"],"font_data":[]}</script><script data-name="wpr-wpr-beacon" src='http://example.org/wp-content/plugins/wp-rocket/assets/js/wpr-beacon.min.js' async></script></body>
</html>
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,5 @@
<link rel="stylesheet" href="http://example.org/assets/fonts/font1.woff2">
<link rel="stylesheet" href="http://example.org/assets/fonts/font2.ttf">
</head>
<body><script>var rocket_beacon_data = {"ajax_url":"http:\/\/example.org\/wp-admin\/admin-ajax.php","nonce":"96ac96b69e","url":"http:\/\/example.org","is_mobile":false,"width_threshold":1600,"height_threshold":700,"delay":500,"debug":false,"status":{"atf":true,"lrc":true},"elements":"img, video, picture, p, main, div, li, svg, section, header, span","lrc_threshold":1800,"system_fonts":["serif","sans-serif","monospace","cursive","fantasy","system-ui","ui-serif","ui-sans-serif","ui-monospace","ui-rounded","Arial","Helvetica","Times New Roman","Times","Courier New","Courier","Georgia","Palatino","Garamond","Bookman","Tahoma","Trebuchet MS","Arial Black","Impact","Comic Sans MS"]}</script><script data-name="wpr-wpr-beacon" src='http://example.org/wp-content/plugins/wp-rocket/assets/js/wpr-beacon.min.js' async></script></body>
<body><script>var rocket_beacon_data = {"ajax_url":"http:\/\/example.org\/wp-admin\/admin-ajax.php","nonce":"96ac96b69e","url":"http:\/\/example.org","is_mobile":false,"width_threshold":1600,"height_threshold":700,"delay":500,"debug":false,"status":{"atf":true,"lrc":true,"preload_fonts":true},"elements":"img, video, picture, p, main, div, li, svg, section, header, span","lrc_threshold":1800,"system_fonts":["serif","sans-serif","monospace","cursive","fantasy","system-ui","ui-serif","ui-sans-serif","ui-monospace","ui-rounded","Arial","Helvetica","Times New Roman","Times","Courier New","Courier","Georgia","Palatino","Garamond","Bookman","Tahoma","Trebuchet MS","Arial Black","Impact","Comic Sans MS"],"font_data":[]}</script><script data-name="wpr-wpr-beacon" src='http://example.org/wp-content/plugins/wp-rocket/assets/js/wpr-beacon.min.js' async></script></body>
</html>
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,5 @@
<link rel="stylesheet" href="http://external.domain/assets/fonts/font1.woff2">
<link rel="stylesheet" href="http://example.org/assets/fonts/font2.ttf">
</head>
<body><script>var rocket_beacon_data = {"ajax_url":"http:\/\/example.org\/wp-admin\/admin-ajax.php","nonce":"96ac96b69e","url":"http:\/\/example.org","is_mobile":false,"width_threshold":1600,"height_threshold":700,"delay":500,"debug":false,"status":{"atf":true,"lrc":true},"elements":"img, video, picture, p, main, div, li, svg, section, header, span","lrc_threshold":1800,"system_fonts":["serif","sans-serif","monospace","cursive","fantasy","system-ui","ui-serif","ui-sans-serif","ui-monospace","ui-rounded","Arial","Helvetica","Times New Roman","Times","Courier New","Courier","Georgia","Palatino","Garamond","Bookman","Tahoma","Trebuchet MS","Arial Black","Impact","Comic Sans MS"]}</script><script data-name="wpr-wpr-beacon" src='http://example.org/wp-content/plugins/wp-rocket/assets/js/wpr-beacon.min.js' async></script></body>
<body><script>var rocket_beacon_data = {"ajax_url":"http:\/\/example.org\/wp-admin\/admin-ajax.php","nonce":"96ac96b69e","url":"http:\/\/example.org","is_mobile":false,"width_threshold":1600,"height_threshold":700,"delay":500,"debug":false,"status":{"atf":true,"lrc":true,"preload_fonts":true},"elements":"img, video, picture, p, main, div, li, svg, section, header, span","lrc_threshold":1800,"system_fonts":["serif","sans-serif","monospace","cursive","fantasy","system-ui","ui-serif","ui-sans-serif","ui-monospace","ui-rounded","Arial","Helvetica","Times New Roman","Times","Courier New","Courier","Georgia","Palatino","Garamond","Bookman","Tahoma","Trebuchet MS","Arial Black","Impact","Comic Sans MS"],"font_data":[]}</script><script data-name="wpr-wpr-beacon" src='http://example.org/wp-content/plugins/wp-rocket/assets/js/wpr-beacon.min.js' async></script></body>
</html>
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,5 @@
<link rel="stylesheet" href="/assets/fonts/font1.woff2">
<link rel="stylesheet" href="/assets/fonts/font2.ttf">
</head>
<body><script>var rocket_beacon_data = {"ajax_url":"http:\/\/example.org\/wp-admin\/admin-ajax.php","nonce":"96ac96b69e","url":"http:\/\/example.org","is_mobile":false,"width_threshold":1600,"height_threshold":700,"delay":500,"debug":false,"status":{"atf":true,"lrc":true},"elements":"img, video, picture, p, main, div, li, svg, section, header, span","lrc_threshold":1800,"system_fonts":["serif","sans-serif","monospace","cursive","fantasy","system-ui","ui-serif","ui-sans-serif","ui-monospace","ui-rounded","Arial","Helvetica","Times New Roman","Times","Courier New","Courier","Georgia","Palatino","Garamond","Bookman","Tahoma","Trebuchet MS","Arial Black","Impact","Comic Sans MS"]}</script><script data-name="wpr-wpr-beacon" src='http://example.org/wp-content/plugins/wp-rocket/assets/js/wpr-beacon.min.js' async></script></body>
<body><script>var rocket_beacon_data = {"ajax_url":"http:\/\/example.org\/wp-admin\/admin-ajax.php","nonce":"96ac96b69e","url":"http:\/\/example.org","is_mobile":false,"width_threshold":1600,"height_threshold":700,"delay":500,"debug":false,"status":{"atf":true,"lrc":true,"preload_fonts":true},"elements":"img, video, picture, p, main, div, li, svg, section, header, span","lrc_threshold":1800,"system_fonts":["serif","sans-serif","monospace","cursive","fantasy","system-ui","ui-serif","ui-sans-serif","ui-monospace","ui-rounded","Arial","Helvetica","Times New Roman","Times","Courier New","Courier","Georgia","Palatino","Garamond","Bookman","Tahoma","Trebuchet MS","Arial Black","Impact","Comic Sans MS"],"font_data":[]}</script><script data-name="wpr-wpr-beacon" src='http://example.org/wp-content/plugins/wp-rocket/assets/js/wpr-beacon.min.js' async></script></body>
</html>
Loading

0 comments on commit daa4504

Please sign in to comment.