Skip to content

Commit 716a329

Browse files
committed
Tests: Make font test data providers static.
Declare the data providers in `tests/phpunit/tests/fonts/` as `public static` for compatibility with newer PHPUnit versions. Preserve their datasets and assertions. Developed in: #14400 Props rejaulalomkhan. See #66211. git-svn-id: https://develop.svn.wordpress.org/trunk@64448 602fd350-edb4-49c9-b593-d223f7449a82
1 parent 4b28542 commit 716a329

7 files changed

Lines changed: 18 additions & 18 deletions

File tree

‎tests/phpunit/tests/fonts/font-face/wpFontFaceResolver/getFontsFromThemeJson.php‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ static function ( $font ) use ( $font_name, $font_weight, $font_style ) {
9393
*
9494
* @return array
9595
*/
96-
public function data_should_replace_src_file_placeholder() {
96+
public static function data_should_replace_src_file_placeholder() {
9797
return array(
9898
// Theme's theme.json.
9999
'DM Sans: 400 normal' => array(
@@ -174,7 +174,7 @@ function ( $font ) use ( $expected_name ) {
174174
*
175175
* @return array
176176
*/
177-
public function data_should_get_font_family_name() {
177+
public static function data_should_get_font_family_name() {
178178
$font_face = array(
179179
array(
180180
'fontFamily' => 'DM Sans',

‎tests/phpunit/tests/fonts/font-library/wpFontCollection/getData.php‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ public function test_should_get_data_from_json_url( $slug, $config, $expected_da
8686
*
8787
* @return array
8888
*/
89-
public function data_create_font_collection() {
89+
public static function data_create_font_collection() {
9090
return array(
9191
'font collection with required data' => array(
9292
'slug' => 'my-collection',
@@ -225,7 +225,7 @@ public function test_should_error_when_missing_properties( $config ) {
225225
*
226226
* @return array
227227
*/
228-
public function data_should_error_when_missing_properties() {
228+
public static function data_should_error_when_missing_properties() {
229229
return array(
230230
'missing name' => array(
231231
'config' => array(

‎tests/phpunit/tests/fonts/font-library/wpFontUtils/getFontFaceSlug.php‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ public function test_get_font_face_slug_normalizes_values( $settings, $expected_
2828
*
2929
* @return array
3030
*/
31-
public function data_get_font_face_slug_normalizes_values() {
31+
public static function data_get_font_face_slug_normalizes_values() {
3232
return array(
3333
'Sets defaults' => array(
3434
'settings' => array(

‎tests/phpunit/tests/fonts/font-library/wpFontUtils/sanitizeFontFamily.php‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ public function test_should_sanitize_font_family( $font_family, $expected ) {
3232
*
3333
* @return array
3434
*/
35-
public function data_should_sanitize_font_family() {
35+
public static function data_should_sanitize_font_family() {
3636
return array(
3737
'data_families_with_spaces_and_numbers' => array(
3838
'font_family' => 'Arial, Rock 3D , Open Sans,serif',

‎tests/phpunit/tests/fonts/font-library/wpFontUtils/sanitizeFromSchema.php‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ public function test_sanitize_from_schema( $data, $schema, $expected ) {
2424
$this->assertSame( $result, $expected );
2525
}
2626

27-
public function data_sanitize_from_schema() {
27+
public static function data_sanitize_from_schema() {
2828
return array(
2929
'One level associative array' => array(
3030
'data' => array(

‎tests/phpunit/tests/fonts/font-library/wpRestFontFacesController.php‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -178,7 +178,7 @@ public function test_context_param( $single_route = false ) {
178178
*
179179
* @return array
180180
*/
181-
public function data_get_context_param() {
181+
public static function data_get_context_param() {
182182
return array(
183183
'Collection' => array( false ),
184184
'Single' => array( true ),
@@ -682,7 +682,7 @@ public function test_create_item_invalid_theme_json_version( $theme_json_version
682682
*
683683
* @return array
684684
*/
685-
public function data_create_item_invalid_theme_json_version() {
685+
public static function data_create_item_invalid_theme_json_version() {
686686
return array(
687687
array( 1 ),
688688
array( 4 ),
@@ -712,7 +712,7 @@ public function test_create_item_invalid_settings( $settings ) {
712712
*
713713
* @return array
714714
*/
715-
public function data_create_item_invalid_settings() {
715+
public static function data_create_item_invalid_settings() {
716716
return array(
717717
'Missing fontFamily' => array(
718718
'settings' => array_diff_key( self::$default_settings, array( 'fontFamily' => '' ) ),
@@ -860,7 +860,7 @@ public function test_create_item_sanitize_font_face_settings( $settings, $expect
860860
*
861861
* @return array
862862
*/
863-
public function data_sanitize_font_face_settings() {
863+
public static function data_sanitize_font_face_settings() {
864864
return array(
865865
'settings with tags, extra whitespace, new lines' => array(
866866
'settings' => array(

‎tests/phpunit/tests/fonts/font-library/wpRestFontFamiliesController.php‎

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -194,7 +194,7 @@ public function test_context_param( $single_route = false ) {
194194
*
195195
* @return array
196196
*/
197-
public function data_get_context_param() {
197+
public static function data_get_context_param() {
198198
return array(
199199
'Collection' => array( false ),
200200
'Single' => array( true ),
@@ -423,7 +423,7 @@ public function test_create_item_invalid_theme_json_version( $theme_json_version
423423
*
424424
* @return array
425425
*/
426-
public function data_create_item_invalid_theme_json_version() {
426+
public static function data_create_item_invalid_theme_json_version() {
427427
return array(
428428
array( 1 ),
429429
array( 4 ),
@@ -458,7 +458,7 @@ public function test_create_item_with_default_preview( $settings ) {
458458
*
459459
* @return array
460460
*/
461-
public function data_create_item_with_default_preview() {
461+
public static function data_create_item_with_default_preview() {
462462
$default_settings = array(
463463
'name' => 'Open Sans',
464464
'slug' => 'open-sans-2',
@@ -503,7 +503,7 @@ public function test_create_item_sanitize_font_family_settings( $settings, $expe
503503
*
504504
* @return array
505505
*/
506-
public function data_sanitize_font_family_settings() {
506+
public static function data_sanitize_font_family_settings() {
507507
return array(
508508
'settings with tags, extra whitespace, new lines' => array(
509509
'settings' => array(
@@ -574,7 +574,7 @@ public function test_create_item_invalid_settings( $settings ) {
574574
*
575575
* @return array
576576
*/
577-
public function data_create_item_invalid_settings() {
577+
public static function data_create_item_invalid_settings() {
578578
return array(
579579
'Missing name' => array(
580580
'settings' => array_diff_key( self::$default_settings, array( 'name' => '' ) ),
@@ -746,7 +746,7 @@ public function test_update_item_individual_settings( $settings ) {
746746
*
747747
* @return array
748748
*/
749-
public function data_update_item_individual_settings() {
749+
public static function data_update_item_individual_settings() {
750750
return array(
751751
array( array( 'name' => 'Opened Sans' ) ),
752752
array( array( 'fontFamily' => '"Opened Sans", sans-serif' ) ),
@@ -806,7 +806,7 @@ public function test_update_item_empty_settings( $settings ) {
806806
*
807807
* @return array
808808
*/
809-
public function data_update_item_invalid_settings() {
809+
public static function data_update_item_invalid_settings() {
810810
return array(
811811
'Empty name' => array(
812812
array( 'name' => '' ),

0 commit comments

Comments
 (0)