Wordpress/tests/phpunit/tests/l10n.php
Sergey Biryukov 959f377c3e I18N: Add a unit test for before_last_bar().
Props realloc.
Fixes #35073.

git-svn-id: https://develop.svn.wordpress.org/trunk@35959 602fd350-edb4-49c9-b593-d223f7449a82
2015-12-16 08:03:38 +00:00

30 lines
949 B
PHP

<?php
/**
* @group l10n
* @group i18n
*/
class Tests_L10n extends WP_UnitTestCase {
function test_load_unload_textdomain() {
$this->assertFalse( is_textdomain_loaded( 'wp-tests-domain' ) );
$this->assertFalse( unload_textdomain( 'wp-tests-domain' ) );
$file = DIR_TESTDATA . '/pomo/simple.mo';
$this->assertTrue( load_textdomain( 'wp-tests-domain', $file ) );
$this->assertTrue( is_textdomain_loaded( 'wp-tests-domain' ) );
$this->assertTrue( unload_textdomain( 'wp-tests-domain' ) );
$this->assertFalse( is_textdomain_loaded( 'wp-tests-domain' ) );
}
/**
* @ticket 35073
*/
function test_before_last_bar() {
$this->assertEquals( 'no-bar-at-all', before_last_bar( 'no-bar-at-all' ) );
$this->assertEquals( 'before-last-bar', before_last_bar( 'before-last-bar|after-bar' ) );
$this->assertEquals( 'first-before-bar|second-before-bar', before_last_bar( 'first-before-bar|second-before-bar|after-last-bar' ) );
}
}