Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
b3ca322
Added tests for wp_timezone_choice
pbearne Nov 21, 2023
56fcd36
Added tests for wp_timezone_choice
pbearne Nov 22, 2023
f9643e3
Added tests for wp_timezone_choice
pbearne Nov 22, 2023
42aa0e4
Added tests for wp_timezone_choice
pbearne Nov 22, 2023
667615c
Added tests for wp_timezone_choice
pbearne Nov 22, 2023
3697adf
Merge branch 'WordPress:trunk' into 59941-wp_timezone_choice
pbearne Feb 28, 2024
80e7ac8
Remove redundant city translations in ES locale
pbearne Feb 28, 2024
0b01da3
Merge remote-tracking branch 'origin/59941-wp_timezone_choice' into 5…
pbearne Feb 28, 2024
2201680
Update Spanish locale message translations
pbearne Mar 1, 2024
df1d06e
Update wpTimezoneChoice.php
pbearne Feb 25, 2025
be19af9
Merge branch 'WordPress:trunk' into 59941-wp_timezone_choice
pbearne Jul 30, 2025
5d205cb
Apply suggestion from @westonruter
pbearne Nov 5, 2025
e0fc718
Apply suggestion from @westonruter
pbearne Nov 5, 2025
2266748
Apply suggestion from @westonruter
pbearne Nov 5, 2025
19d7104
Apply suggestion from @westonruter
pbearne Nov 5, 2025
8ab218a
changed to use datasets
Nov 5, 2025
cfc4be7
whitespace
Nov 5, 2025
08f64e5
whitespace
Nov 5, 2025
bde40da
whitespace
Nov 5, 2025
ecfdcaa
whitespace
Nov 5, 2025
5cb74b2
fix: correct class name casing and improve docblock formatting in tim…
SirLouen Nov 5, 2025
82736cf
Apply suggestions from code review
pbearne Nov 6, 2025
fb3fd55
Remove duplicate PHPDoc blocks
t-hamano Nov 7, 2025
0b35c25
Merge branch 'trunk' into 59941-wp_timezone_choice
westonruter Nov 7, 2025
5069002
Use 'functions' as test group for consistency
westonruter Nov 7, 2025
73fad58
Tidy phpdoc
westonruter Nov 7, 2025
828c8af
Merge branch 'trunk' into 59941-wp_timezone_choice
westonruter Nov 24, 2025
db4e98a
Merge https://github.com/pbearne/wordpress-develop/pull/183
westonruter Nov 24, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
<?php
return ['domain'=>NULL,'plural-forms'=>'nplurals=2; plural=n != 1;','messages'=>['Vincennes'=>'Vincennes','Winamac'=>'Winamac','Inuvik'=>'Inuvik','Iqaluit'=>'Iqaluit','Jamaica'=>'Jamaica'],'language'=>'es_ES','x-generator'=>'Poedit 1.8.10'];
return ['domain'=>NULL,'plural-forms'=>'nplurals=2; plural=n != 1;','messages'=>['Port Moresby'=>'Puerto Moresby','Arctic'=>'Ártico','Vincennes'=>'Vincennes','Winamac'=>'Winamac','Inuvik'=>'Inuvik','Iqaluit'=>'Iqaluit','Jamaica'=>'Jamaica'],'language'=>'es_ES','x-generator'=>'Poedit 1.8.10'];
Binary file modified tests/phpunit/data/languages/continents-cities-es_ES.mo
Binary file not shown.
42 changes: 23 additions & 19 deletions tests/phpunit/data/languages/continents-cities-es_ES.po
Original file line number Diff line number Diff line change
@@ -1,32 +1,36 @@
# Translation of Continents & Cities in Spanish (Spain)
# This file is distributed under the same license as the Continents & Cities package.
# Translation of WordPress - 6.4.x - Development - Continents & Cities in Spanish (Spain)
# This file is distributed under the same license as the WordPress - 6.4.x - Development - Continents & Cities package.
msgid ""
msgstr ""
"PO-Revision-Date: 2016-10-26 00:01+0200\n"
"PO-Revision-Date: 2022-10-12 09:13:34+0000\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=2; plural=n != 1;\n"
"X-Generator: Poedit 1.8.10\n"
"Project-Id-Version: Continents & Cities\n"
"Language: es_ES\n"
"X-Generator: GlotPress/4.0.0-alpha.11\n"
"Language: es\n"
"Project-Id-Version: WordPress - 6.4.x - Development - Continents & Cities\n"

#: wp-admin/includes/continents-cities.php:140
msgid "Vincennes"
msgstr "Vincennes"
#: wp-admin/includes/continents-cities.php:539
msgid "Port Moresby"
msgstr "Puerto Moresby"

#: wp-admin/includes/continents-cities.php:141
msgid "Winamac"
msgstr "Winamac"
#: wp-admin/includes/continents-cities.php:248
msgid "Arctic"
msgstr "Ártico"

#: wp-admin/includes/continents-cities.php:149
msgid "Iqaluit"
msgstr "Iqaluit"

#: wp-admin/includes/continents-cities.php:142
#: wp-admin/includes/continents-cities.php:148
msgid "Inuvik"
msgstr "Inuvik"

#: wp-admin/includes/continents-cities.php:143
msgid "Iqaluit"
msgstr "Iqaluit"
#: wp-admin/includes/continents-cities.php:146
msgid "Vincennes"
msgstr "Vincennes"

#: wp-admin/includes/continents-cities.php:144
msgid "Jamaica"
msgstr "Jamaica"
#: wp-admin/includes/continents-cities.php:147
msgid "Winamac"
msgstr "Winamac"
2 changes: 1 addition & 1 deletion tests/phpunit/data/languages/es_ES.l10n.php
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
<?php
return ['domain'=>NULL,'plural-forms'=>'nplurals=2; plural=n != 1;','messages'=>['text directionltr'=>'ltr','<strong>ERROR</strong>: Sorry, that username is not allowed.'=>'<strong>ERROR</strong>: Lo siento, ese nombre de usuario no está permitido.','Invalid parameter.'=>'Parámetro no válido. ','menu location(Current: %s)'=>'(Actual: %s)','menu(Currently set to: %s)'=>'(Actualmente fijado en: %s)','[%1$s] Confirm Action: %2$s'=>'[%1$s] Confirmar la acción: %2$s','[%s] Erasure Request Fulfilled'=>'[%s] Solicitud de borrado completada','[%s] Personal Data Export'=>'[%s] Exportación de datos personales'],'language'=>'es_ES','x-generator'=>'Poedit 2.3'];
return ['domain'=>NULL,'plural-forms'=>'nplurals=2; plural=n != 1;','messages'=>['text directionltr'=>'ltr','<strong>ERROR</strong>: Sorry, that username is not allowed.'=>'<strong>ERROR</strong>: Lo siento, ese nombre de usuario no está permitido.','Invalid parameter.'=>'Parámetro no válido. ','menu location(Current: %s)'=>'(Actual: %s)','menu(Currently set to: %s)'=>'(Actualmente fijado en: %s)','[%1$s] Confirm Action: %2$s'=>'[%1$s] Confirmar la acción: %2$s','[%s] Erasure Request Fulfilled'=>'[%s] Solicitud de borrado completada','[%s] Personal Data Export'=>'[%s] Exportación de datos personales', 'Manual Offsets' => 'Compensaciones manuales', 'Select a city' => 'Elige una ciudad' ],'language'=>'es_ES','x-generator'=>'Poedit 2.3'];
Binary file modified tests/phpunit/data/languages/es_ES.mo
Binary file not shown.
59 changes: 34 additions & 25 deletions tests/phpunit/data/languages/es_ES.po
Original file line number Diff line number Diff line change
@@ -1,55 +1,64 @@
# Translation of Development (5.2.x) in Spanish (Spain)
# This file is distributed under the same license as the Development (5.2.x) package.
# Translation of WordPress - 6.4.x - Development in Spanish (Spain)
# This file is distributed under the same license as the WordPress - 6.4.x - Development package.
msgid ""
msgstr ""
"PO-Revision-Date: 2020-07-23 21:12+0300\n"
"Project-Id-Version: WordPress - 6.4.x - Development\n"
"POT-Creation-Date: \n"
"PO-Revision-Date: 2024-02-28 14:31-0500\n"
"Last-Translator: \n"
"Language-Team: \n"
"Language: es\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=2; plural=n != 1;\n"
"X-Generator: Poedit 2.3\n"
"Project-Id-Version: Development (5.2.x)\n"
"Language: es_ES\n"
"POT-Creation-Date: \n"
"Last-Translator: \n"
"Language-Team: \n"
"X-Generator: Poedit 3.4.2\n"

#: wp-includes/functions.php:6635
msgid "Manual Offsets"
msgstr "Compensaciones manuales"

#: wp-includes/functions.php:6574
msgid "Select a city"
msgstr "Elige una ciudad"

#. translators: 'rtl' or 'ltr'. This sets the text direction for WordPress.
#: wp-includes/locale.php:201
#: wp-includes/class-wp-locale.php:248 wp-includes/script-loader.php:325
#: wp-includes/js/dist/i18n.js:1398
#, gp-priority: high
msgctxt "text direction"
msgid "ltr"
msgstr "ltr"

#: wp-includes/user.php:2132
msgid "<strong>ERROR</strong>: Sorry, that username is not allowed."
msgstr "<strong>ERROR</strong>: Lo siento, ese nombre de usuario no está permitido."
#: wp-includes/user.php:3357 wp-admin/includes/user.php:202
msgid "<strong>Error:</strong> Sorry, that username is not allowed."
msgstr "<strong>Error</strong>: lo siento, ese nombre de usuario no está permitido."

#: wp-includes/rest-api/class-wp-rest-request.php:850
#: wp-includes/rest-api/class-wp-rest-request.php:916
msgid "Invalid parameter."
msgstr "Parámetro no válido. "

#. translators: %s: menu name
#: wp-includes/customize/class-wp-customize-nav-menu-control.php:76
#. translators: %s: Menu name.
#: wp-includes/customize/class-wp-customize-nav-menu-locations-control.php:79
msgctxt "menu location"
msgid "(Current: %s)"
msgstr "(Actual: %s)"

#. translators: %s: menu location slug
#: wp-includes/class-wp-customize-nav-menus.php:340
#. translators: %s: Menu location.
#: wp-includes/class-wp-customize-nav-menus.php:510
msgctxt "menu"
msgid "(Currently set to: %s)"
msgstr "(Actualmente fijado en: %s)"

#. translators: Privacy data request subject. 1: Site name, 2: Name of the action
#: wp-includes/user.php:3445
#. translators: Confirm privacy data request notification email subject. 1:
#. Site title, 2: Name of the action.
#: wp-includes/user.php:4705
msgid "[%1$s] Confirm Action: %2$s"
msgstr "[%1$s] Confirmar la acción: %2$s"

#. translators: %s: Site name.
#: wp-includes/user.php:3175
#. translators: Erasure request fulfilled notification email subject. %s: Site
#. title.
#: wp-includes/user.php:4299
msgid "[%s] Erasure Request Fulfilled"
msgstr "[%s] Solicitud de borrado completada"

#: wp-admin/includes/file.php:2415
msgid "[%s] Personal Data Export"
msgstr "[%s] Exportación de datos personales"
146 changes: 146 additions & 0 deletions tests/phpunit/tests/functions/wpTimezoneChoice.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,146 @@
<?php

/**
* Tests for the wp_timezone_choice function.
*
* @group functions
*
* @covers ::wp_timezone_choice
*/
class Tests_Functions_WpTimezoneChoice extends WP_UnitTestCase {

/**
* Tears down.
*/
public function tear_down() {
restore_current_locale();
parent::tear_down();
}

/**
* Tests default values.
*
* @ticket 59941
* @dataProvider data_wp_timezone_choice
*
* @param string $expected Expected string HTML fragment.
*/
public function test_wp_timezone_choice( $expected ) {
$timezone_list = wp_timezone_choice( '' );
$this->assertStringContainsString( $expected, $timezone_list );
}

/**
* Gets data sets for test_wp_timezone_choice.
*
* @return array<string, string[]>
*/
public function data_wp_timezone_choice(): array {
return array(
'placeholder option' => array( '<option selected="selected" value="">Select a city</option>' ),
'city in Americas' => array( '<option value="America/Los_Angeles">Los Angeles</option>' ),
'deprecated timezone' => array( '<option value="Pacific/Honolulu">Honolulu</option>' ),
'manual offset example' => array( '<option value="UTC-8">UTC-8</option>' ),
'UTC option' => array( '<option value="UTC">UTC</option>' ),
'continent example' => array( '<option value="Africa/Johannesburg">Johannesburg</option>' ),
'city example' => array( '<option value="Asia/Kuala_Lumpur">Kuala Lumpur</option>' ),
'city with sub-city' => array( '<option value="America/Argentina/Buenos_Aires">Argentina - Buenos Aires</option>' ),
'translated city name appears' => array( '<option value="Pacific/Port_Moresby">Port Moresby</option>' ),
);
}

/**
* Tests zones are selected from the list.
*
* @ticket 59941
* @dataProvider data_wp_timezone_choice_selected
*
* @param string $selected_zone The timezone to select.
* @param string $expected Expected string HTML fragment.
*/
public function test_wp_timezone_choice_selected( $selected_zone, $expected ) {
$actual = wp_timezone_choice( $selected_zone );
$this->assertStringContainsString( $expected, $actual );
}

/**
* Gets data sets for test_wp_timezone_choice_selected.
*
* @return array<string, string[]>
*/
public function data_wp_timezone_choice_selected(): array {
return array(
'city from the list' => array(
'America/Los_Angeles',
'<option selected="selected" value="America/Los_Angeles">Los Angeles</option>',
),
'deprecated but valid timezone string' => array(
'Pacific/Auckland',
'<option selected="selected" value="Pacific/Auckland">Auckland</option>',
),
'UTC' => array(
'UTC',
'<option selected="selected" value="UTC">UTC</option>',
),
'manual UTC offset' => array(
'UTC+10',
'<option selected="selected" value="UTC+10">UTC+10</option>',
),
);
}

/**
* Tests passing in the locale.
*
* @ticket 59941
* @dataProvider data_wp_timezone_choice_es
*
* @param string $expected Expected string HTML fragment.
*/
public function test_wp_timezone_choice_es( $expected ) {
$timezone_list = wp_timezone_choice( '', 'es_ES' );
$this->assertStringContainsString( $expected, $timezone_list );
}

/**
* Gets data sets for test_wp_timezone_choice_es.
*
* @return array<string, string[]>
*/
public function data_wp_timezone_choice_es(): array {
return array(
'placeholder remains in English (no translation override passed)' => array( '<option selected="selected" value="">Select a city</option>' ),
'spanish city translation' => array( '<option value="Pacific/Port_Moresby">Puerto Moresby</option>' ),
'spanish optgroup Arctic' => array( '<optgroup label="Ártico">' ),
'spanish optgroup Manual Offsets untranslated' => array( '<optgroup label="Manual Offsets">' ),
);
}

/**
* Tests setting the locale globally.
*
* @ticket 59941
* @dataProvider data_wp_timezone_choice_es_set
*
* @param string $expected Expected string HTML fragment.
*/
public function test_wp_timezone_choice_es_set( $expected ) {
switch_to_locale( 'es_ES' );
$timezone_list = wp_timezone_choice( '' );
$this->assertStringContainsString( $expected, $timezone_list );
}

/**
* Gets data sets for test_wp_timezone_choice_es_set.
*
* @return array<string, string[]>
*/
public function data_wp_timezone_choice_es_set(): array {
return array(
'placeholder in Spanish' => array( '<option selected="selected" value="">Elige una ciudad</option>' ),
'spanish city translation' => array( '<option value="Pacific/Port_Moresby">Puerto Moresby</option>' ),
'spanish optgroup Arctic' => array( '<optgroup label="Ártico">' ),
'spanish optgroup Manual Offsets' => array( '<optgroup label="Compensaciones manuales">' ),
);
}
}
Loading