wordpress-playground
wordpress-playground copied to clipboard
[ Intl ] Fix Intl feature inside Blueprints in Playground
Motivation for the change, related issues
Based on this issue.
Related to this function.
It looks like the ICU data is not found when running the below Blueprint. Even if the file is located in /internal/shared before running the playground.run(...) in run-php.ts.
Implementation details
- Added a new
Intl classes should work when intl is enabledtest inplayground/website/playwright/e2e/blueprints.spec.ts
Blueprint
{
"features": {
"intl": true
},
"steps": [
{
"step": "runPHP",
"code": "<?php \n\n$data = array(\n 'F' => 'Foo',\n 'Br' => 'Bar',\n 'Bz' => 'Bz',\n);\n\n$collator = new Collator('en_US');\n$collator->asort($data, Collator::SORT_STRING);\n\nthrow new Exception( json_encode($data, JSON_PRETTY_PRINT ) );"
}
]
}
Should throw :
Uncaught Exception: {
"Br": "Bar",
"Bz": "Bz",
"F": "Foo"
}
But throws :
Uncaught IntlException: Constructor failed