Opened 4 years ago
Closed 4 years ago
#35294 closed enhancement (fixed)
Modification in phpdoc and unit tests for wp_dropdown_languages()
Reported by: | realloc | Owned by: | ocean90 |
---|---|---|---|
Milestone: | 4.5 | Priority: | normal |
Severity: | normal | Version: | 4.0 |
Component: | I18N | Keywords: | has-unit-tests needs-patch |
Focuses: | Cc: |
Description
I wrote a unit test for wp_dropdown_languages(). I added also a filter when this test is running so there will be no call to the API. I changed the php documentation too because this function returns always the generated output even when the param echo is set to true.
Attachments (2)
Change History (10)
#3
follow-up:
↓ 4
@
4 years ago
- Milestone changed from Awaiting Review to 4.5
- Version changed from trunk to 4.0
These assertions are good, but they are brittle because they test the output of the function in its entirety. I think it would be better to test various pieces of the output (using assertContains()
or assertRegExp()
) to ensure they are as expected.
For example, what is actually being tested here is that the correct languages are output in the correct optgroup, and the expected attributes are present.
@realloc Do you want to take another look at this?
#4
in reply to:
↑ 3
@
4 years ago
Replying to johnbillion:
@realloc Do you want to take another look at this?
Thanks for your tips, John! I'll have a look at it very soon.
PhpDoc and unit test for wp_dropdown_languages()