WordPress.org

Make WordPress Core

Ticket #35442: 35442 is_textdomain_loaded-unit-test.patch

File 35442 is_textdomain_loaded-unit-test.patch, 968 bytes (added by jrf, 6 years ago)

Example code as unit test for this issue

  • tests/phpunit/tests/l10n.php

    From 87fea1ed07aaa36326283af3f633c3ab8ea87b29 Mon Sep 17 00:00:00 2001
    From: jrfnl <github_nospam@adviesenzo.nl>
    Date: Wed, 13 Jan 2016 13:26:32 +0100
    Subject: [PATCH] Unit test to accompany ticket #35442
    
    ---
     tests/phpunit/tests/l10n.php | 9 +++++++++
     1 file changed, 9 insertions(+)
    
    diff --git a/tests/phpunit/tests/l10n.php b/tests/phpunit/tests/l10n.php
    index 62357f0..51a0f3b 100644
    a b class Tests_L10n extends WP_UnitTestCase { 
    2626                $this->assertEquals( 'first-before-bar|second-before-bar', before_last_bar( 'first-before-bar|second-before-bar|after-last-bar' ) );
    2727        }
    2828
     29        /**
     30         * @ticket 35442
     31         */
     32        function test_is_textdomain_loaded() {
     33                $this->assertFalse( is_textdomain_loaded( 'wp-tests-domain' ) );
     34                $try_translate = __( 'just some string', 'wp-tests-domain' );
     35                $this->assertFalse( is_textdomain_loaded( 'wp-tests-domain' ) );
     36        }
     37
    2938}