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' ); } /** * @dataProvider data_textdomain_sources */ function test_basic_add_textdomain( $source, $expected ) { $tokens = token_get_all( $source ); $result = $this->atd->process_tokens( 'foo', $tokens ); $this->assertEquals( $expected, $result ); } function data_textdomain_sources() { return array( array( "", "" ), // Simple single quotes array( '', "" ), // Simple double quotes array( "", "" ), // Simple single quotes CS array( '', "" ), // Simple double quotes CS array( "", "" ), // Multiple string args array( '', '' ), // Multiple string / var args array( "", "" ), // Existing textdomain ); } }