WordPress.org

Make WordPress Core

Ticket #37819: 37819.unittestOnly.diff

File 37819.unittestOnly.diff, 5.9 KB (added by imath, 3 years ago)
  • tests/phpunit/data/languages/internationalized-plugin/internationalized-plugin-fr_FR.mo

    Cannot display: file marked as a binary type.
    svn:mime-type = application/octet-stream
  • tests/phpunit/data/languages/internationalized-plugin/internationalized-plugin-fr_FR.po

    Property changes on: tests/phpunit/data/languages/internationalized-plugin/internationalized-plugin-fr_FR.mo
    ___________________________________________________________________
    Added: svn:mime-type
    ## -0,0 +1 ##
    +application/octet-stream
    \ No newline at end of property
     
     1msgid ""
     2msgstr ""
     3"Project-Id-Version: internationalized plugin\n"
     4"POT-Creation-Date: 2016-09-19 07:36+0100\n"
     5"PO-Revision-Date: 2016-09-19 08:07+0100\n"
     6"Last-Translator: imath <mathchristo@yahoo.fr>\n"
     7"Language-Team: \n"
     8"Language: fr_FR\n"
     9"MIME-Version: 1.0\n"
     10"Content-Type: text/plain; charset=UTF-8\n"
     11"Content-Transfer-Encoding: 8bit\n"
     12"X-Generator: Poedit 1.7.1\n"
     13"X-Poedit-Basepath: .\n"
     14"Plural-Forms: nplurals=2; plural=(n > 1);\n"
     15"X-Poedit-KeywordsList: __;_e;_x:1,2c;_ex:1,2c;_n:1,2;_nx:1,2,4c;_n_noop:1,2;"
     16"_nx_noop:1,2,3c;esc_attr__;esc_html__;esc_attr_e;esc_html_e;esc_attr_x:1,2c;"
     17"esc_html_x:1,2c\n"
     18"X-Textdomain-Support: yes\n"
     19"X-Poedit-SearchPath-0: .\n"
     20
     21#: internationalized-plugin.php:11
     22msgid "This is a dummy plugin"
     23msgstr "Ceci est un plugin factice"
  • tests/phpunit/data/languages/plugins/internationalized-plugin-fr_FR.mo

    Cannot display: file marked as a binary type.
    svn:mime-type = application/octet-stream
  • tests/phpunit/data/languages/plugins/internationalized-plugin-fr_FR.po

    Property changes on: tests/phpunit/data/languages/plugins/internationalized-plugin-fr_FR.mo
    ___________________________________________________________________
    Added: svn:mime-type
    ## -0,0 +1 ##
    +application/octet-stream
    \ No newline at end of property
     
     1msgid ""
     2msgstr ""
     3"Project-Id-Version: internationalized plugin\n"
     4"POT-Creation-Date: 2016-09-19 07:36+0100\n"
     5"PO-Revision-Date: 2016-09-19 07:52+0100\n"
     6"Last-Translator: imath <mathchristo@yahoo.fr>\n"
     7"Language-Team: \n"
     8"Language: fr_FR\n"
     9"MIME-Version: 1.0\n"
     10"Content-Type: text/plain; charset=UTF-8\n"
     11"Content-Transfer-Encoding: 8bit\n"
     12"X-Generator: Poedit 1.7.1\n"
     13"X-Poedit-Basepath: .\n"
     14"Plural-Forms: nplurals=2; plural=(n > 1);\n"
     15"X-Poedit-KeywordsList: __;_e;_x:1,2c;_ex:1,2c;_n:1,2;_nx:1,2,4c;_n_noop:1,2;"
     16"_nx_noop:1,2,3c;esc_attr__;esc_html__;esc_attr_e;esc_html_e;esc_attr_x:1,2c;"
     17"esc_html_x:1,2c\n"
     18"X-Textdomain-Support: yes\n"
     19"X-Poedit-SearchPath-0: .\n"
     20
     21#: internationalized-plugin.php:11
     22msgid "This is a dummy plugin"
     23msgstr "Ceci est un dummy plugin"
     24
     25#: internationalized-plugin.php:15
     26msgid "This is another string"
     27msgstr "Ceci est une autre chaine de caractères"
  • tests/phpunit/data/plugins/internationalized-plugin.php

     
    1010function i18n_plugin_test() {
    1111        return __( 'This is a dummy plugin', 'internationalized-plugin' );
    1212}
     13
     14function i18n_plugin_test_2() {
     15        return __( 'This is another string', 'internationalized-plugin' );
     16}
  • tests/phpunit/tests/l10n/loadTextdomainJustInTime.php

     
    4848                return 'de_DE';
    4949        }
    5050
     51        public function filter_set_locale_to_french() {
     52                return 'fr_FR';
     53        }
     54
    5155        /**
    5256         * @ticket 34114
    5357         */
     
    141145                $this->assertSame( 'Das ist ein Dummy Plugin', $expected_output_final );
    142146                $this->assertTrue( $is_textdomain_loaded_final );
    143147        }
     148
     149        /**
     150         * @ticket 37819
     151         */
     152        public function test_should_allow_custom_text_domain() {
     153                add_filter( 'locale', array( $this, 'filter_set_locale_to_french' ) );
     154
     155                require_once DIR_TESTDATA . '/plugins/internationalized-plugin.php';
     156
     157                $this->assertSame( 'Ceci est un dummy plugin', i18n_plugin_test() );
     158
     159                $this->assertSame( 'Ceci est une autre chaine de caractères', i18n_plugin_test_2() );
     160
     161                load_textdomain( 'internationalized-plugin', WP_LANG_DIR . '/internationalized-plugin/internationalized-plugin-fr_FR.mo' );
     162
     163                $this->assertSame( 'Ceci est un plugin factice', i18n_plugin_test() );
     164
     165                $this->assertSame( 'Ceci est une autre chaine de caractères', i18n_plugin_test_2() );
     166
     167                remove_filter( 'locale', array( $this, 'filter_set_locale_to_french' ) );
     168        }
    144169}