_n() function mocker always returns first string (singular)
jigneshnakrani088 opened this issue · comments
Jignesh Nakrani commented
Describe the bug
_n() function mocker always returns the first string (singular) regardless number passed in the argument list.
The reason for the behaviour is mocker here function-mocks.php#L159 uses predefined_return_function_helper that always first item from the arguments array.
To Reproduce
Below is the code that produces the error.
public function test_check_n_output_wp_mock() {
$output = check_n_output_wp_mock();
$this->assertEquals( 'People', $output );
}
It returns Person
instead of People
code being tested:
function check_n_output_wp_mock() {
return _n( 'Person', 'People', 3 );
}
Expected behaviour
_n() Mocker should the singular or plural form based on the supplied number.