mirror of
https://github.com/gosticks/wordpress-develop.git
synced 2025-10-16 12:05:38 +00:00
I18N: Improve docblocks after [57337].
Props mukesh27. See #59656. git-svn-id: https://develop.svn.wordpress.org/trunk@57344 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
parent
78ef4f749e
commit
28fd787c0c
@ -225,7 +225,6 @@ class WP_Textdomain_Registry {
|
||||
* @type string $version The version of a theme, plugin, or core.
|
||||
* }
|
||||
* }
|
||||
* @return void
|
||||
*/
|
||||
public function invalidate_mo_files_cache( $upgrader, $hook_extra ) {
|
||||
if (
|
||||
|
||||
@ -284,7 +284,6 @@ abstract class WP_Translation_File {
|
||||
*/
|
||||
abstract protected function parse_file();
|
||||
|
||||
|
||||
/**
|
||||
* Exports translation contents as a string.
|
||||
*
|
||||
|
||||
@ -80,8 +80,8 @@ class WP_Translations {
|
||||
*
|
||||
* @since 6.5.0
|
||||
*
|
||||
* @param string $original Original string to translate from MO file. Might contain
|
||||
* 0x04 as context separator or 0x00 as singular/plural separator.
|
||||
* @param string $original Original string to translate from MO file. Might contain
|
||||
* 0x04 as context separator or 0x00 as singular/plural separator.
|
||||
* @param string $translations Translation strings from MO file.
|
||||
* @return Translation_Entry Entry instance.
|
||||
*/
|
||||
|
||||
@ -5,9 +5,6 @@
|
||||
* @group i18n
|
||||
*/
|
||||
class WP_Translation_Controller_Tests extends WP_UnitTestCase {
|
||||
/**
|
||||
* @return void
|
||||
*/
|
||||
public function tear_down() {
|
||||
remove_all_filters( 'translation_file_format' );
|
||||
unload_textdomain( 'wp-tests-domain' );
|
||||
@ -21,8 +18,6 @@ class WP_Translation_Controller_Tests extends WP_UnitTestCase {
|
||||
* @covers WP_Translation_Controller::get_entries
|
||||
* @covers WP_Translation_Controller::get_headers
|
||||
* @covers WP_Translation_Controller::normalize_header
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function test_load_textdomain() {
|
||||
global $l10n;
|
||||
@ -73,8 +68,6 @@ class WP_Translation_Controller_Tests extends WP_UnitTestCase {
|
||||
* @covers WP_Translation_Controller::get_entries
|
||||
* @covers WP_Translation_Controller::get_headers
|
||||
* @covers WP_Translation_Controller::normalize_header
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function test_load_textdomain_existing_override() {
|
||||
add_filter( 'override_load_textdomain', '__return_true' );
|
||||
@ -93,8 +86,6 @@ class WP_Translation_Controller_Tests extends WP_UnitTestCase {
|
||||
|
||||
/**
|
||||
* @covers ::load_textdomain
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function test_load_textdomain_php_files() {
|
||||
$load_php_successful = load_textdomain( 'wp-tests-domain', DIR_TESTDATA . '/pomo/simple.l10n.php' );
|
||||
@ -107,8 +98,6 @@ class WP_Translation_Controller_Tests extends WP_UnitTestCase {
|
||||
|
||||
/**
|
||||
* @covers ::load_textdomain
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function test_load_textdomain_prefers_php_files_by_default() {
|
||||
$load_successful = load_textdomain( 'wp-tests-domain', DIR_TESTDATA . '/pomo/simple.mo' );
|
||||
@ -131,8 +120,6 @@ class WP_Translation_Controller_Tests extends WP_UnitTestCase {
|
||||
|
||||
/**
|
||||
* @covers ::load_textdomain
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function test_load_textdomain_reads_php_files_if_filtered_format_is_unsupported() {
|
||||
add_filter(
|
||||
@ -158,8 +145,6 @@ class WP_Translation_Controller_Tests extends WP_UnitTestCase {
|
||||
|
||||
/**
|
||||
* @covers ::load_textdomain
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function test_load_textdomain_existing_translation_is_kept() {
|
||||
global $l10n;
|
||||
@ -183,8 +168,6 @@ class WP_Translation_Controller_Tests extends WP_UnitTestCase {
|
||||
|
||||
/**
|
||||
* @covers ::load_textdomain
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function test_load_textdomain_loads_existing_translation() {
|
||||
global $l10n;
|
||||
@ -205,8 +188,6 @@ class WP_Translation_Controller_Tests extends WP_UnitTestCase {
|
||||
|
||||
/**
|
||||
* @covers ::load_textdomain
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function test_load_textdomain_loads_existing_translation_mo_files() {
|
||||
global $l10n;
|
||||
@ -236,8 +217,6 @@ class WP_Translation_Controller_Tests extends WP_UnitTestCase {
|
||||
|
||||
/**
|
||||
* @covers ::load_textdomain
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function test_load_textdomain_loads_existing_translation_php_files() {
|
||||
global $l10n;
|
||||
@ -268,8 +247,6 @@ class WP_Translation_Controller_Tests extends WP_UnitTestCase {
|
||||
* @covers WP_Translation_Controller::get_entries
|
||||
* @covers WP_Translation_Controller::get_headers
|
||||
* @covers WP_Translation_Controller::normalize_header
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function test_unload_textdomain() {
|
||||
global $l10n;
|
||||
@ -296,8 +273,6 @@ class WP_Translation_Controller_Tests extends WP_UnitTestCase {
|
||||
|
||||
/**
|
||||
* @covers ::unload_textdomain
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function test_unload_textdomain_existing_override() {
|
||||
add_filter( 'override_unload_textdomain', '__return_true' );
|
||||
@ -323,8 +298,6 @@ class WP_Translation_Controller_Tests extends WP_UnitTestCase {
|
||||
/**
|
||||
* @covers ::unload_file
|
||||
* @covers ::unload_textdomain
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function test_unload_non_existent_files_and_textdomains() {
|
||||
$controller = new WP_Translation_Controller();
|
||||
@ -338,8 +311,6 @@ class WP_Translation_Controller_Tests extends WP_UnitTestCase {
|
||||
/**
|
||||
* @covers ::load_textdomain
|
||||
* @covers ::unload_textdomain
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function test_switch_to_locale_translations_stay_loaded_default_textdomain() {
|
||||
switch_to_locale( 'es_ES' );
|
||||
@ -363,8 +334,6 @@ class WP_Translation_Controller_Tests extends WP_UnitTestCase {
|
||||
* @covers ::load_textdomain
|
||||
* @covers ::unload_textdomain
|
||||
* @covers ::change_locale
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function test_switch_to_locale_translations_stay_loaded_custom_textdomain() {
|
||||
$this->assertSame( 'en_US', WP_Translation_Controller::instance()->get_locale() );
|
||||
|
||||
@ -6,9 +6,6 @@
|
||||
* @group i18n
|
||||
*/
|
||||
class WP_Translations_Tests extends WP_UnitTestCase {
|
||||
/**
|
||||
* @return void
|
||||
*/
|
||||
public function tear_down() {
|
||||
unload_textdomain( 'wp-tests-domain' );
|
||||
|
||||
@ -19,8 +16,6 @@ class WP_Translations_Tests extends WP_UnitTestCase {
|
||||
* @covers ::__construct
|
||||
* @covers ::__get
|
||||
* @covers ::make_entry
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function test_get_entries() {
|
||||
global $l10n;
|
||||
@ -58,8 +53,6 @@ class WP_Translations_Tests extends WP_UnitTestCase {
|
||||
/**
|
||||
* @covers ::__get
|
||||
* @covers ::make_entry
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function test_get_entries_plural() {
|
||||
global $l10n;
|
||||
@ -99,8 +92,6 @@ class WP_Translations_Tests extends WP_UnitTestCase {
|
||||
/**
|
||||
* @covers ::__get
|
||||
* @covers ::make_entry
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function test_get_entries_context() {
|
||||
global $l10n;
|
||||
@ -145,8 +136,6 @@ class WP_Translations_Tests extends WP_UnitTestCase {
|
||||
|
||||
/**
|
||||
* @covers ::__get
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function test_get_headers() {
|
||||
global $l10n;
|
||||
@ -174,8 +163,6 @@ class WP_Translations_Tests extends WP_UnitTestCase {
|
||||
|
||||
/**
|
||||
* @covers ::__get
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function test_getter_unsupported_property() {
|
||||
global $l10n;
|
||||
@ -191,8 +178,6 @@ class WP_Translations_Tests extends WP_UnitTestCase {
|
||||
|
||||
/**
|
||||
* @covers ::translate
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function test_translate() {
|
||||
global $l10n;
|
||||
@ -214,8 +199,6 @@ class WP_Translations_Tests extends WP_UnitTestCase {
|
||||
|
||||
/**
|
||||
* @covers ::translate_plural
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function test_translate_plural() {
|
||||
global $l10n;
|
||||
@ -239,8 +222,6 @@ class WP_Translations_Tests extends WP_UnitTestCase {
|
||||
|
||||
/**
|
||||
* @covers ::translate_plural
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function test_translate_plural_missing() {
|
||||
global $l10n;
|
||||
@ -265,8 +246,6 @@ class WP_Translations_Tests extends WP_UnitTestCase {
|
||||
* @covers ::translate_plural
|
||||
*
|
||||
* @ticket 41257
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function test_translate_invalid_edge_cases() {
|
||||
load_textdomain( 'wp-tests-domain', DIR_TESTDATA . '/pomo/simple.mo' );
|
||||
|
||||
@ -8,8 +8,6 @@
|
||||
class WP_Translation_Controller_Convert_Tests extends WP_UnitTestCase {
|
||||
/**
|
||||
* @covers ::instance
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function test_get_instance() {
|
||||
$instance = WP_Translation_Controller::instance();
|
||||
@ -18,9 +16,6 @@ class WP_Translation_Controller_Convert_Tests extends WP_UnitTestCase {
|
||||
$this->assertSame( $instance, $instance2 );
|
||||
}
|
||||
|
||||
/**
|
||||
* @return void
|
||||
*/
|
||||
public function test_no_files_loaded_returns_false() {
|
||||
$instance = new WP_Translation_Controller();
|
||||
$this->assertFalse( $instance->translate( 'singular' ) );
|
||||
@ -29,8 +24,6 @@ class WP_Translation_Controller_Convert_Tests extends WP_UnitTestCase {
|
||||
|
||||
/**
|
||||
* @covers ::unload_textdomain
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function test_unload_not_loaded() {
|
||||
$instance = new WP_Translation_Controller();
|
||||
@ -45,8 +38,6 @@ class WP_Translation_Controller_Convert_Tests extends WP_UnitTestCase {
|
||||
* @covers ::translate
|
||||
* @covers ::locate_translation
|
||||
* @covers ::get_files
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function test_unload_entire_textdomain() {
|
||||
$instance = new WP_Translation_Controller();
|
||||
@ -64,8 +55,6 @@ class WP_Translation_Controller_Convert_Tests extends WP_UnitTestCase {
|
||||
/**
|
||||
* @covers ::unload_file
|
||||
* @covers WP_Translation_File::get_file
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function test_unload_file_is_not_actually_loaded() {
|
||||
$controller = new WP_Translation_Controller();
|
||||
@ -79,8 +68,6 @@ class WP_Translation_Controller_Convert_Tests extends WP_UnitTestCase {
|
||||
/**
|
||||
* @covers ::unload_textdomain
|
||||
* @covers ::is_textdomain_loaded
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function test_unload_specific_locale() {
|
||||
$instance = new WP_Translation_Controller();
|
||||
@ -111,9 +98,6 @@ class WP_Translation_Controller_Convert_Tests extends WP_UnitTestCase {
|
||||
* @param string $type
|
||||
* @param string $file_contents
|
||||
* @param string|bool $expected_error
|
||||
* @return void
|
||||
*
|
||||
* @phpstan-param 'mo'|'php' $type
|
||||
*/
|
||||
public function test_invalid_files( string $type, string $file_contents, $expected_error = null ) {
|
||||
$file = $this->temp_filename();
|
||||
@ -157,8 +141,6 @@ class WP_Translation_Controller_Convert_Tests extends WP_UnitTestCase {
|
||||
/**
|
||||
* @covers WP_Translation_Controller::load
|
||||
* @covers WP_Translation_Controller::is_textdomain_loaded
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function test_load_non_existent_file() {
|
||||
$instance = new WP_Translation_Controller();
|
||||
@ -169,8 +151,6 @@ class WP_Translation_Controller_Convert_Tests extends WP_UnitTestCase {
|
||||
|
||||
/**
|
||||
* @covers WP_Translation_File::create
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function test_create_non_existent_file() {
|
||||
$this->assertFalse( WP_Translation_File::create( 'this-file-does-not-exist' ) );
|
||||
@ -178,8 +158,6 @@ class WP_Translation_Controller_Convert_Tests extends WP_UnitTestCase {
|
||||
|
||||
/**
|
||||
* @covers WP_Translation_File::create
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function test_create_invalid_filetype() {
|
||||
$file = $this->temp_filename();
|
||||
@ -199,7 +177,6 @@ class WP_Translation_Controller_Convert_Tests extends WP_UnitTestCase {
|
||||
* @dataProvider data_simple_example_files
|
||||
*
|
||||
* @param string $file
|
||||
* @return void
|
||||
*/
|
||||
public function test_simple_translation_files( string $file ) {
|
||||
$controller = new WP_Translation_Controller();
|
||||
@ -243,8 +220,6 @@ class WP_Translation_Controller_Convert_Tests extends WP_UnitTestCase {
|
||||
* @covers ::get_files
|
||||
* @covers WP_Translation_File::get_plural_form
|
||||
* @covers WP_Translation_File::make_plural_form_function
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function test_load_multiple_files() {
|
||||
$controller = new WP_Translation_Controller();
|
||||
@ -293,8 +268,6 @@ class WP_Translation_Controller_Convert_Tests extends WP_UnitTestCase {
|
||||
* @covers ::is_textdomain_loaded
|
||||
* @covers ::translate
|
||||
* @covers ::translate_plural
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function test_load_multiple_locales() {
|
||||
$controller = new WP_Translation_Controller();
|
||||
@ -334,8 +307,6 @@ class WP_Translation_Controller_Convert_Tests extends WP_UnitTestCase {
|
||||
|
||||
/**
|
||||
* @covers ::unload_textdomain
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function test_unload_with_multiple_locales() {
|
||||
$ginger_mo = new WP_Translation_Controller();
|
||||
@ -371,8 +342,6 @@ class WP_Translation_Controller_Convert_Tests extends WP_UnitTestCase {
|
||||
/**
|
||||
* @covers ::load
|
||||
* @covers ::locate_translation
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function test_load_with_default_textdomain() {
|
||||
$controller = new WP_Translation_Controller();
|
||||
@ -384,8 +353,6 @@ class WP_Translation_Controller_Convert_Tests extends WP_UnitTestCase {
|
||||
|
||||
/**
|
||||
* @covers ::load
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function test_load_same_file_twice() {
|
||||
$controller = new WP_Translation_Controller();
|
||||
@ -397,8 +364,6 @@ class WP_Translation_Controller_Convert_Tests extends WP_UnitTestCase {
|
||||
|
||||
/**
|
||||
* @covers ::load
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function test_load_file_is_already_loaded_for_different_textdomain() {
|
||||
$controller = new WP_Translation_Controller();
|
||||
@ -418,8 +383,6 @@ class WP_Translation_Controller_Convert_Tests extends WP_UnitTestCase {
|
||||
* @covers ::get_files
|
||||
* @covers WP_Translation_File::get_plural_form
|
||||
* @covers WP_Translation_File::make_plural_form_function
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function test_load_no_plurals() {
|
||||
$controller = new WP_Translation_Controller();
|
||||
@ -439,8 +402,6 @@ class WP_Translation_Controller_Convert_Tests extends WP_UnitTestCase {
|
||||
|
||||
/**
|
||||
* @covers ::get_headers
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function test_get_headers_no_loaded_translations() {
|
||||
$controller = new WP_Translation_Controller();
|
||||
@ -450,8 +411,6 @@ class WP_Translation_Controller_Convert_Tests extends WP_UnitTestCase {
|
||||
|
||||
/**
|
||||
* @covers ::get_headers
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function test_get_headers_with_default_textdomain() {
|
||||
$controller = new WP_Translation_Controller();
|
||||
@ -467,8 +426,6 @@ class WP_Translation_Controller_Convert_Tests extends WP_UnitTestCase {
|
||||
|
||||
/**
|
||||
* @covers ::get_headers
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function test_get_headers_no_loaded_translations_for_domain() {
|
||||
$controller = new WP_Translation_Controller();
|
||||
@ -480,8 +437,6 @@ class WP_Translation_Controller_Convert_Tests extends WP_UnitTestCase {
|
||||
|
||||
/**
|
||||
* @covers ::get_entries
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function test_get_entries_no_loaded_translations() {
|
||||
$controller = new WP_Translation_Controller();
|
||||
@ -491,8 +446,6 @@ class WP_Translation_Controller_Convert_Tests extends WP_UnitTestCase {
|
||||
|
||||
/**
|
||||
* @covers ::get_entries
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function test_get_entries_with_default_textdomain() {
|
||||
$controller = new WP_Translation_Controller();
|
||||
@ -509,8 +462,6 @@ class WP_Translation_Controller_Convert_Tests extends WP_UnitTestCase {
|
||||
|
||||
/**
|
||||
* @covers ::get_entries
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function test_get_entries_no_loaded_translations_for_domain() {
|
||||
$controller = new WP_Translation_Controller();
|
||||
@ -524,9 +475,6 @@ class WP_Translation_Controller_Convert_Tests extends WP_UnitTestCase {
|
||||
*
|
||||
* @param string $source_file
|
||||
* @param string $destination_format
|
||||
* @return void
|
||||
*
|
||||
* @phpstan-param 'mo'|'php' $destination_format
|
||||
*/
|
||||
public function test_convert_format( string $source_file, string $destination_format ) {
|
||||
$destination_file = $this->temp_filename();
|
||||
@ -586,8 +534,6 @@ class WP_Translation_Controller_Convert_Tests extends WP_UnitTestCase {
|
||||
|
||||
/**
|
||||
* @covers WP_Translation_File::transform
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function test_convert_format_invalid_source() {
|
||||
$this->assertFalse( WP_Translation_File::transform( 'this-file-does-not-exist', 'invalid' ) );
|
||||
|
||||
Loading…
Reference in New Issue
Block a user