Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
8 changes: 8 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,14 @@ You will also need a container environment such as [Docker Desktop](https://www.

**Note:** WordPress currently only officially supports Docker but several container environments are available and should generally be compatible, such as [Colima](https://github.com/abiosoft/colima), [OrbStack](https://orbstack.dev/), [Podman Desktop](https://podman-desktop.io/), and [Rancher Desktop](https://rancherdesktop.io/).

#### Windows-specific instructions

For development on Windows, [Windows Subsystem for Linux (WSL)](https://learn.microsoft.com/en-us/windows/wsl/install) is recommended. This provides a Linux environment where the general development instructions can be used without modification.

After installing Docker Desktop, enable Docker's WSL integration under **Settings > Resources > WSL integration**. This only needs to be configured once.

If you use Docker Desktop directly from Windows without WSL, make sure it is using Linux containers. Right-click the Docker icon in the system tray and select **Switch to Linux containers...**. If that option is not available, or the menu shows **Switch to Windows containers...**, Docker is already using Linux containers. You can switch between container types later if another project requires Windows containers.

### Development Environment Commands

Ensure your container environment is running before using these commands.
Expand Down
16 changes: 10 additions & 6 deletions tests/phpunit/tests/db/charset.php
Original file line number Diff line number Diff line change
Expand Up @@ -749,7 +749,7 @@ public function test_strip_invalid_text_for_column() {
),
),
array(
'definition' => '( a VARCHAR(50) CHARACTER SET utf8, b TEXT CHARACTER SET utf8mb4 )',
'definition' => '( a VARCHAR(50) CHARACTER SET utf8mb3, b TEXT CHARACTER SET utf8mb4 )',
'table_expected' => 'utf8',
'column_expected' => array(
'a' => 'utf8',
Expand Down Expand Up @@ -786,6 +786,7 @@ public function data_get_table_charset() {
/**
* @dataProvider data_get_table_charset
* @ticket 21212
* @ticket 66072
*
* @covers wpdb::get_table_charset
*/
Expand Down Expand Up @@ -822,6 +823,7 @@ public function data_get_column_charset() {
/**
* @dataProvider data_get_column_charset
* @ticket 21212
* @ticket 66072
*
* @covers wpdb::get_col_charset
*/
Expand Down Expand Up @@ -907,7 +909,7 @@ public function data_strip_invalid_text_from_query() {
),
'utf8 + utf8mb4' => array(
// utf8/utf8mb4 tables default to utf8.
'create' => '( a VARCHAR(50) CHARACTER SET utf8, b VARCHAR(50) CHARACTER SET utf8mb4 )',
'create' => '( a VARCHAR(50) CHARACTER SET utf8mb3, b VARCHAR(50) CHARACTER SET utf8mb4 )',
'query' => "('foo\xf0\x9f\x98\x88bar', 'foo')",
'expected' => "('foobar', 'foo')",
),
Expand All @@ -931,6 +933,7 @@ public function data_strip_invalid_text_from_query() {
/**
* @dataProvider data_strip_invalid_text_from_query
* @ticket 21212
* @ticket 66072
*
* @covers wpdb::strip_invalid_text_from_query
*/
Expand Down Expand Up @@ -1155,14 +1158,15 @@ public function test_no_db_charset_defined() {

/**
* @ticket 36649
* @ticket 66072
*
* @covers wpdb::set_charset
*/
public function test_set_charset_changes_the_connection_collation() {
self::$_wpdb->set_charset( self::$_wpdb->dbh, 'utf8', 'utf8_general_ci' );
$results = self::$_wpdb->get_results( "SHOW VARIABLES WHERE Variable_name='collation_connection'" );
$expected = self::$utf8_is_utf8mb3 ? 'utf8mb3_general_ci' : 'utf8_general_ci';
$this->assertSame( $expected, $results[0]->Value, "Collation should be set to $expected." );
// Avoid the `utf8` alias: it resolves to utf8mb3 or utf8mb4 depending on the server version.
self::$_wpdb->set_charset( self::$_wpdb->dbh, 'utf8mb4', 'utf8mb4_general_ci' );
$results = self::$_wpdb->get_results( "SHOW VARIABLES WHERE Variable_name='collation_connection'" );
$this->assertSame( 'utf8mb4_general_ci', $results[0]->Value, 'Collation should be set to utf8mb4_general_ci.' );

self::$_wpdb->set_charset( self::$_wpdb->dbh, 'utf8mb4', 'utf8mb4_unicode_ci' );
$results = self::$_wpdb->get_results( "SHOW VARIABLES WHERE Variable_name='collation_connection'" );
Expand Down
Loading