WordPress.org

Make WordPress Core

Ticket #21319: 21319-unittests.diff

File 21319-unittests.diff, 983 bytes (added by MikeHansenMe, 7 years ago)

see #30284

  • tests/phpunit/tests/l10n.php

    diff --git a/tests/phpunit/tests/l10n.php b/tests/phpunit/tests/l10n.php
    index 3f195ca..09ba546 100644
    a b class Tests_L10n extends WP_UnitTestCase { 
    1616                $this->assertTrue( unload_textdomain( 'wp-tests-domain' ) );
    1717                $this->assertFalse( is_textdomain_loaded( 'wp-tests-domain' ) );
    1818        }
     19
     20        /**
     21         * @ticket 21319
     22         */
     23        function test_is_textdomain_loaded_for_no_translations() {
     24                $this->assertFalse( load_textdomain( 'wp-tests-domain', DIR_TESTDATA . '/non-existent-file' ) );
     25                $this->assertFalse( is_textdomain_loaded( 'wp-tests-domain' ) );
     26                $this->assertInstanceOf( 'NOOP_Translations', get_translations_for_domain( 'wp-tests-domain' ) );
     27                // Ensure that we don't confuse NOOP_Translations to be a loaded text domain.
     28                $this->assertFalse( is_textdomain_loaded( 'wp-tests-domain' ) );
     29                $this->assertFalse( unload_textdomain( 'wp-tests-domain' ) );
     30        }
    1931}
     32 No newline at end of file