i18n tools: Add a test for the add-textdomain.php script.
git-svn-id: https://develop.svn.wordpress.org/trunk@36389 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
parent
b07466c2bf
commit
1e1ac57375
24
tools/i18n/t/AddTextdomainTest.php
Executable file
24
tools/i18n/t/AddTextdomainTest.php
Executable file
@ -0,0 +1,24 @@
|
|||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* Tests for add-textdomain.php
|
||||||
|
*
|
||||||
|
* @package wordpress-i18n
|
||||||
|
* @subpackage tools
|
||||||
|
*/
|
||||||
|
error_reporting( E_ALL );
|
||||||
|
require_once dirname( dirname( __FILE__ ) ) . '/add-textdomain.php';
|
||||||
|
|
||||||
|
class AddTextDomainTest extends PHPUnit_Framework_TestCase {
|
||||||
|
|
||||||
|
function __construct() {
|
||||||
|
$this->atd = new AddTextdomain;
|
||||||
|
}
|
||||||
|
|
||||||
|
function test_add() {
|
||||||
|
# copy to a new file, so that we don't corrupt the old one
|
||||||
|
copy( 'data/add-textdomain-0.php', 'data/add-textdomain-0-work.php' );
|
||||||
|
$this->atd->process_file( 'test-domain', 'data/add-textdomain-0-work.php', true );
|
||||||
|
$this->assertEquals( file_get_contents( 'data/add-textdomain-0-result.php' ), file_get_contents( 'data/add-textdomain-0-work.php' ) );
|
||||||
|
unlink( 'data/add-textdomain-0-work.php' );
|
||||||
|
}
|
||||||
|
}
|
17
tools/i18n/t/data/add-textdomain-0-result.php
Executable file
17
tools/i18n/t/data/add-textdomain-0-result.php
Executable file
@ -0,0 +1,17 @@
|
|||||||
|
<?php
|
||||||
|
function call_some_i18n_methods() {
|
||||||
|
__( 'Hello World' , 'test-domain');
|
||||||
|
_e( 'Hello World' , 'test-domain');
|
||||||
|
_n( 'Single', 'Plural', 1 , 'test-domain');
|
||||||
|
_n_noop( 'Single Noop', 'Plural Noop', 1 , 'test-domain');
|
||||||
|
_x( 'Hello World', 'Testing' , 'test-domain');
|
||||||
|
_ex( 'Hello World', 'Testing' , 'test-domain');
|
||||||
|
_nx( 'Hello World', 'Testing' , 'test-domain');
|
||||||
|
_nx_noop( 'Hello World Noop', 'Testing' , 'test-domain');
|
||||||
|
esc_attr__( 'Attribute' , 'test-domain');
|
||||||
|
esc_html__( 'HTML' , 'test-domain');
|
||||||
|
esc_attr_e( 'Attribute' , 'test-domain');
|
||||||
|
esc_html_e( 'HTML' , 'test-domain');
|
||||||
|
esc_attr_x( 'Attribute', 'Testing' , 'test-domain');
|
||||||
|
esc_html_x( 'HTML', 'Testing' , 'test-domain');
|
||||||
|
}
|
17
tools/i18n/t/data/add-textdomain-0.php
Executable file
17
tools/i18n/t/data/add-textdomain-0.php
Executable file
@ -0,0 +1,17 @@
|
|||||||
|
<?php
|
||||||
|
function call_some_i18n_methods() {
|
||||||
|
__( 'Hello World' );
|
||||||
|
_e( 'Hello World' );
|
||||||
|
_n( 'Single', 'Plural', 1 );
|
||||||
|
_n_noop( 'Single Noop', 'Plural Noop', 1 );
|
||||||
|
_x( 'Hello World', 'Testing' );
|
||||||
|
_ex( 'Hello World', 'Testing' );
|
||||||
|
_nx( 'Hello World', 'Testing' );
|
||||||
|
_nx_noop( 'Hello World Noop', 'Testing' );
|
||||||
|
esc_attr__( 'Attribute' );
|
||||||
|
esc_html__( 'HTML' );
|
||||||
|
esc_attr_e( 'Attribute' );
|
||||||
|
esc_html_e( 'HTML' );
|
||||||
|
esc_attr_x( 'Attribute', 'Testing' );
|
||||||
|
esc_html_x( 'HTML', 'Testing' );
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user