diff --git a/tests/phpunit/tests/l10n.php b/tests/phpunit/tests/l10n.php index 1934b90236..e5713da2b2 100644 --- a/tests/phpunit/tests/l10n.php +++ b/tests/phpunit/tests/l10n.php @@ -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' ) );