diff --git a/phpunit/tests/fonts/font-library/fontFamilyBackwardsCompatibility.php b/phpunit/tests/fonts/font-library/fontFamilyBackwardsCompatibility.php index 4305237d53292f..dc720b6b7db701 100644 --- a/phpunit/tests/fonts/font-library/fontFamilyBackwardsCompatibility.php +++ b/phpunit/tests/fonts/font-library/fontFamilyBackwardsCompatibility.php @@ -11,7 +11,7 @@ * @group font-library */ class Tests_Font_Family_Backwards_Compatibility extends WP_UnitTestCase { - private $post_ids_to_delete = array(); + private $post_ids_to_delete; public function set_up() { parent::set_up(); diff --git a/phpunit/tests/fonts/font-library/wpFontCollection/loadFromJson.php b/phpunit/tests/fonts/font-library/wpFontCollection/loadFromJson.php index 6c7b3bd23a6f3e..cf9ba7faa93f19 100644 --- a/phpunit/tests/fonts/font-library/wpFontCollection/loadFromJson.php +++ b/phpunit/tests/fonts/font-library/wpFontCollection/loadFromJson.php @@ -105,7 +105,7 @@ public function mock_request( $preempt, $args, $url ) { } return array( - 'body' => json_encode( self::$mock_collection_data ), + 'body' => wp_json_encode( self::$mock_collection_data ), 'response' => array( 'code' => 200, ), @@ -122,7 +122,7 @@ public function mock_request_missing_slug( $preempt, $args, $url ) { unset( $mock_collection_data['slug'] ); return array( - 'body' => json_encode( $mock_collection_data ), + 'body' => wp_json_encode( $mock_collection_data ), 'response' => array( 'code' => 200, ), diff --git a/phpunit/tests/fonts/font-library/wpFontLibrary/getFontCollections.php b/phpunit/tests/fonts/font-library/wpFontLibrary/getFontCollections.php index 1b17e7070454eb..394c977799a068 100644 --- a/phpunit/tests/fonts/font-library/wpFontLibrary/getFontCollections.php +++ b/phpunit/tests/fonts/font-library/wpFontLibrary/getFontCollections.php @@ -26,7 +26,7 @@ public function test_should_get_mock_font_collection() { WP_Font_Library::register_font_collection( 'my-font-collection', $my_font_collection_config ); $font_collections = WP_Font_Library::get_font_collections(); - $this->assertNotEmpty( $font_collections, 'Sould return an array of font collections.' ); + $this->assertNotEmpty( $font_collections, 'Should return an array of font collections.' ); $this->assertCount( 1, $font_collections, 'Should return an array with one font collection.' ); $this->assertArrayHasKey( 'my-font-collection', $font_collections, 'The array should have the key of the registered font collection id.' ); $this->assertInstanceOf( 'WP_Font_Collection', $font_collections['my-font-collection'], 'The value of the array $font_collections[id] should be an instance of WP_Font_Collection class.' ); diff --git a/phpunit/tests/fonts/font-library/wpFontLibrary/unregisterFontCollection.php b/phpunit/tests/fonts/font-library/wpFontLibrary/unregisterFontCollection.php index 423a2cdf9550c6..9546d0082eff92 100644 --- a/phpunit/tests/fonts/font-library/wpFontLibrary/unregisterFontCollection.php +++ b/phpunit/tests/fonts/font-library/wpFontLibrary/unregisterFontCollection.php @@ -33,7 +33,7 @@ public function test_should_unregister_font_collection() { } public function unregister_non_existing_collection() { - // Unregisters non existing font collection. + // Unregisters non-existing font collection. WP_Font_Library::unregister_font_collection( 'non-existing-collection' ); $collections = WP_Font_Library::get_font_collections(); $this->assertEmpty( $collections, 'Should not be registered collections.' ); diff --git a/phpunit/tests/fonts/font-library/wpRestFontCollectionsController.php b/phpunit/tests/fonts/font-library/wpRestFontCollectionsController.php index e6143da6da6464..823066c9478af1 100644 --- a/phpunit/tests/fonts/font-library/wpRestFontCollectionsController.php +++ b/phpunit/tests/fonts/font-library/wpRestFontCollectionsController.php @@ -49,8 +49,8 @@ public function test_register_routes() { $this->assertCount( 1, $routes['/wp/v2/font-collections'], 'Rest server has not the collections path initialized.' ); $this->assertCount( 1, $routes['/wp/v2/font-collections/(?P[\/\w-]+)'], 'Rest server has not the collection path initialized.' ); - $this->assertArrayHasKey( 'GET', $routes['/wp/v2/font-collections'][0]['methods'], 'Rest server has not the GET method for collections intialized.' ); - $this->assertArrayHasKey( 'GET', $routes['/wp/v2/font-collections/(?P[\/\w-]+)'][0]['methods'], 'Rest server has not the GET method for collection intialized.' ); + $this->assertArrayHasKey( 'GET', $routes['/wp/v2/font-collections'][0]['methods'], 'Rest server has not the GET method for collections initialized.' ); + $this->assertArrayHasKey( 'GET', $routes['/wp/v2/font-collections/(?P[\/\w-]+)'][0]['methods'], 'Rest server has not the GET method for collection initialized.' ); } /** diff --git a/phpunit/tests/fonts/font-library/wpRestFontFacesController.php b/phpunit/tests/fonts/font-library/wpRestFontFacesController.php index de6ecc3d735146..3067e485822c87 100644 --- a/phpunit/tests/fonts/font-library/wpRestFontFacesController.php +++ b/phpunit/tests/fonts/font-library/wpRestFontFacesController.php @@ -386,12 +386,12 @@ public function test_create_item() { $settings = $data['font_face_settings']; unset( $settings['src'] ); $this->assertSame( - $settings, array( 'fontFamily' => '"Open Sans"', 'fontWeight' => '200', 'fontStyle' => 'normal', ), + $settings, 'The font_face_settings data should match the expected data.' ); @@ -730,14 +730,14 @@ public function test_create_item_invalid_file_src() { } /** - * @dataProvider data_create_item_santize_font_family + * @dataProvider data_create_item_sanitize_font_family * * @covers WP_REST_Font_Face_Controller::sanitize_font_face_settings * * @param string $font_family_setting Setting to test. * @param string $expected Expected result. */ - public function test_create_item_santize_font_family( $font_family_setting, $expected ) { + public function test_create_item_sanitize_font_family( $font_family_setting, $expected ) { $settings = array_merge( self::$default_settings, array( 'fontFamily' => $font_family_setting ) ); wp_set_current_user( self::$admin_id ); @@ -755,7 +755,7 @@ public function test_create_item_santize_font_family( $font_family_setting, $exp * * @return array */ - public function data_create_item_santize_font_family() { + public function data_create_item_sanitize_font_family() { return array( 'multiword font with integer' => array( 'font_family_setting' => 'Libre Barcode 128 Text', @@ -930,11 +930,11 @@ protected function check_font_face_data( $data, $post_id, $links ) { $this->assertSame( $expected, $links['parent'][0]['href'], 'The links for a parent URL from the response data should match the parent\'s REST endpoint.' ); } - protected function check_file_meta( $font_face_id, $srcs ) { + protected function check_file_meta( $font_face_id, $src_attributes ) { $file_meta = get_post_meta( $font_face_id, '_wp_font_face_file' ); - foreach ( $srcs as $src ) { - $file_name = basename( $src ); + foreach ( $src_attributes as $src_attribute ) { + $file_name = basename( $src_attribute ); $this->assertContains( $file_name, $file_meta, 'The uploaded font file path should be saved in the post meta.' ); } }