oik-batch v0.9.2 supports in situ PHPUnit testing of internationalization and localization of plugins.
New methods for PHPUnit testing
Implemented in the BW_UnitTestCase class, which extends WP_UnitTestCase that’s provided in bobbingwide/wordpress-develop-tests.
Helper method | Purpose |
---|---|
arraytohtml | Reduce a print_r’ed string |
assertArrayEqualsFile | Asserts that the HTML array equals the file |
find_test_name | Finds the test name from the call stack |
generate_expected_file | Helps to generate the expected file from actual test output |
generated_expected | Help to generate the expected array from actual test output |
prepareExpectedArray | Converts to an array if required |
prepareFile | Returns the expected file name |
query_la_CY | Queries the currently set locale |
reload_domains | reload domains and enable Just Translate It |
replace_admin_url | replaces instances of admin_url() in $expected |
replace_antispambot | Replace randomised antispambot’d mailto links with known value |
replace_between | Generalised string replace between before and after strings |
replace_created_nonce | Replaces the created nonce with nonsense |
replace_home_url | replaces instances of `home_url()` and `site_url()` in `$expected` |
replace_nonse_with_nonsense | Generalises WordPress generated hidden input nonce fields |
replace_oik_url | replaces instances of oik_url() in generated HTML |
replace_post_id | replaces instances of `”post=” . $post->ID` with `”post=42″` |
switch_to_locale | Switch to a selected locale and reload domains |
tag_break | Inserts new line between tags then converts into an array |
Changes
Change | Reference |
---|---|
Changed: Added helper methods for PHPUnit testing of internationalization/localization | bobbingwide/oik-batch#24 |
Fixed: ALTER TABLE %s engine=%s musn’t have quotes around the table or engine value | bobbingwide/oik-batch#17 |
Fixed: Avoid notice when $_SERVER[‘SERVER_PROTOCOL’] not set | bobbingwide/oik-batch#25 |
Tested: With PHP 7.0 and 7.1 | bobbingwide/oik-batch#18 |
Tested: With WordPress 4.8.2 and 4.9-beta3 |