L10n: Add unit tests for _n_noop()
and _nx_noop()
.
Props realloc. Fixes #35961. git-svn-id: https://develop.svn.wordpress.org/trunk@36766 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
parent
5108255d19
commit
4f91aae382
@ -6,6 +6,33 @@
|
||||
*/
|
||||
class Tests_L10n extends WP_UnitTestCase {
|
||||
|
||||
/**
|
||||
* @ticket 35961
|
||||
*/
|
||||
function test_n_noop() {
|
||||
$text_domain = 'text-domain';
|
||||
$nooped_plural = _n_noop( '%s post', '%s posts', $text_domain );
|
||||
|
||||
$this->assertNotEmpty( $nooped_plural['domain'] );
|
||||
$this->assertEquals( '%s posts', translate_nooped_plural( $nooped_plural, 0, $text_domain ) );
|
||||
$this->assertEquals( '%s post', translate_nooped_plural( $nooped_plural, 1, $text_domain ) );
|
||||
$this->assertEquals( '%s posts', translate_nooped_plural( $nooped_plural, 2, $text_domain ) );
|
||||
}
|
||||
|
||||
/**
|
||||
* @ticket 35961
|
||||
*/
|
||||
function test_nx_noop() {
|
||||
$text_domain = 'text-domain';
|
||||
$nooped_plural = _nx_noop( '%s post', '%s posts', 'my-context', $text_domain );
|
||||
|
||||
$this->assertNotEmpty( $nooped_plural['domain'] );
|
||||
$this->assertNotEmpty( $nooped_plural['context'] );
|
||||
$this->assertEquals( '%s posts', translate_nooped_plural( $nooped_plural, 0, $text_domain ) );
|
||||
$this->assertEquals( '%s post', translate_nooped_plural( $nooped_plural, 1, $text_domain ) );
|
||||
$this->assertEquals( '%s posts', translate_nooped_plural( $nooped_plural, 2, $text_domain ) );
|
||||
}
|
||||
|
||||
function test_load_unload_textdomain() {
|
||||
$this->assertFalse( is_textdomain_loaded( 'wp-tests-domain' ) );
|
||||
$this->assertFalse( unload_textdomain( 'wp-tests-domain' ) );
|
||||
|
Loading…
Reference in New Issue
Block a user