WordPress.org

Make WordPress Core

Changeset 1170 in tests


Ignore:
Timestamp:
12/19/2012 12:56:28 AM (9 years ago)
Author:
SergeyBiryukov
Message:

Use DIR_TESTDATA in pomo tests. props mbijon. see #22989.

Location:
trunk/tests/pomo
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/tests/pomo/test_mo.php

    r1106 r1170  
    55    function test_mo_simple() {
    66        $mo = new MO();
    7         $mo->import_from_file('data/pomo/simple.mo');
     7        $mo->import_from_file(DIR_TESTDATA . '/pomo/simple.mo');
    88        $this->assertEquals(array('Project-Id-Version' => 'WordPress 2.6-bleeding', 'Report-Msgid-Bugs-To' => 'wp-polyglots@lists.automattic.com'), $mo->headers);
    99        $this->assertEquals(2, count($mo->entries));
     
    1414    function test_mo_plural() {
    1515        $mo = new MO();
    16         $mo->import_from_file('data/pomo/plural.mo');
     16        $mo->import_from_file(DIR_TESTDATA . '/pomo/plural.mo');
    1717        $this->assertEquals(1, count($mo->entries));
    1818        $this->assertEquals(array("oney dragoney", "twoey dragoney", "manyey dragoney", "manyeyey dragoney", "manyeyeyey dragoney"), $mo->entries["one dragon"]->translations);
     
    4141    function test_mo_context() {
    4242        $mo = new MO();
    43         $mo->import_from_file('data/pomo/context.mo');
     43        $mo->import_from_file(DIR_TESTDATA . '/pomo/context.mo');
    4444        $this->assertEquals(2, count($mo->entries));
    4545        $plural_entry = new Translation_Entry(array('singular' => 'one dragon', 'plural' => '%d dragons', 'translations' => array("oney dragoney", "twoey dragoney","manyey dragoney"), 'context' => 'dragonland'));
     
    114114    function test_nplurals_with_backslashn() {
    115115        $mo = new MO();
    116         $mo->import_from_file('data/pomo/bad_nplurals.mo');
     116        $mo->import_from_file(DIR_TESTDATA . '/pomo/bad_nplurals.mo');
    117117        $this->assertEquals('%d foro', $mo->translate_plural('%d forum', '%d forums', 1));
    118118        $this->assertEquals('%d foros', $mo->translate_plural('%d forum', '%d forums', 2));
     
    123123        $start = microtime(true);
    124124        $mo = new MO();
    125         $mo->import_from_file('data/pomo/de_DE-2.8.mo');
     125        $mo->import_from_file(DIR_TESTDATA . '/pomo/de_DE-2.8.mo');
    126126        // echo "\nPerformance: ".(microtime(true) - $start)."\n";
    127127    }
     
    132132        if ((ini_get("mbstring.func_overload") & 2) != 0) {
    133133            $mo = new MO();
    134             $mo->import_from_file('data/pomo/overload.mo');
     134            $mo->import_from_file(DIR_TESTDATA . '/pomo/overload.mo');
    135135            $this->assertEquals(array('Табло'), $mo->entries['Dashboard']->translations);
    136136        }
     
    139139    function test_load_pot_file() {
    140140        $mo = new MO();
    141         $this->assertEquals( false, $mo->import_from_file('data/pomo/mo.pot') );
     141        $this->assertEquals( false, $mo->import_from_file(DIR_TESTDATA . '/pomo/mo.pot') );
    142142    }
    143143}
  • trunk/tests/pomo/test_po.php

    r1106 r1170  
    175175    function test_import_from_file() {
    176176        $po = new PO();
    177         $res = $po->import_from_file('data/pomo/simple.po');
     177        $res = $po->import_from_file(DIR_TESTDATA . '/pomo/simple.po');
    178178        $this->assertEquals(true, $res);
    179179
     
    205205    function test_import_from_entry_file_should_give_false() {
    206206        $po = new PO();
    207         $this->assertFalse( $po->import_from_file( 'data/pomo/empty.po' ) );
     207        $this->assertFalse( $po->import_from_file( DIR_TESTDATA . '/pomo/empty.po' ) );
    208208    }
    209209
    210210    function test_import_from_file_with_windows_line_endings_should_work_as_with_unix_line_endings() {
    211211        $po = new PO();
    212         $this->assertTrue( $po->import_from_file( 'data/pomo/windows-line-endings.po' ) );
     212        $this->assertTrue( $po->import_from_file( DIR_TESTDATA . '/pomo/windows-line-endings.po' ) );
    213213        $this->assertEquals( 1, count( $po->entries ) );
    214214    }
Note: See TracChangeset for help on using the changeset viewer.