Changeset 48937 for trunk/tests/phpunit/tests/pomo/po.php
- Timestamp:
- 09/02/2020 12:35:36 AM (5 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/tests/phpunit/tests/pomo/po.php
r47122 r48937 44 44 function test_prepend_each_line() { 45 45 $po = new PO(); 46 $this->assert Equals( 'baba_', $po->prepend_each_line( '', 'baba_' ) );47 $this->assert Equals( 'baba_dyado', $po->prepend_each_line( 'dyado', 'baba_' ) );48 $this->assert Equals( "# baba\n# dyado\n# \n", $po->prepend_each_line( "baba\ndyado\n\n", '# ' ) );46 $this->assertSame( 'baba_', $po->prepend_each_line( '', 'baba_' ) ); 47 $this->assertSame( 'baba_dyado', $po->prepend_each_line( 'dyado', 'baba_' ) ); 48 $this->assertSame( "# baba\n# dyado\n# \n", $po->prepend_each_line( "baba\ndyado\n\n", '# ' ) ); 49 49 } 50 50 … … 52 52 $po = new PO(); 53 53 // Simple. 54 $this->assert Equals( '"baba"', $po->poify( 'baba' ) );54 $this->assertSame( '"baba"', $po->poify( 'baba' ) ); 55 55 // Long word. 56 $this->assert Equals( $this->po_a90, $po->poify( $this->a90 ) );56 $this->assertSame( $this->po_a90, $po->poify( $this->a90 ) ); 57 57 // Tab. 58 $this->assert Equals( '"ba\tba"', $po->poify( "ba\tba" ) );58 $this->assertSame( '"ba\tba"', $po->poify( "ba\tba" ) ); 59 59 // Do not add leading empty string of one-line string ending on a newline. 60 $this->assert Equals( '"\\\\a\\\\n\\n"', $po->poify( "\a\\n\n" ) );60 $this->assertSame( '"\\\\a\\\\n\\n"', $po->poify( "\a\\n\n" ) ); 61 61 // Backslash. 62 $this->assert Equals( '"ba\\\\ba"', $po->poify( 'ba\\ba' ) );62 $this->assertSame( '"ba\\\\ba"', $po->poify( 'ba\\ba' ) ); 63 63 // Random wordpress.pot string. 64 64 $src = 'Categories can be selectively converted to tags using the <a href="%s">category to tag converter</a>.'; 65 $this->assert Equals( '"Categories can be selectively converted to tags using the <a href=\\"%s\\">category to tag converter</a>."', $po->poify( $src ) );66 67 $this->assert EqualsIgnoreEOL( $this->po_mail, $po->poify( $this->mail ) );65 $this->assertSame( '"Categories can be selectively converted to tags using the <a href=\\"%s\\">category to tag converter</a>."', $po->poify( $src ) ); 66 67 $this->assertSameIgnoreEOL( $this->po_mail, $po->poify( $this->mail ) ); 68 68 } 69 69 70 70 function test_unpoify() { 71 71 $po = new PO(); 72 $this->assert Equals( 'baba', $po->unpoify( '"baba"' ) );73 $this->assert Equals( "baba\ngugu", $po->unpoify( '"baba\n"' . "\t\t\t\n" . '"gugu"' ) );74 $this->assert Equals( $this->a90, $po->unpoify( $this->po_a90 ) );75 $this->assert Equals( '\\t\\n', $po->unpoify( '"\\\\t\\\\n"' ) );72 $this->assertSame( 'baba', $po->unpoify( '"baba"' ) ); 73 $this->assertSame( "baba\ngugu", $po->unpoify( '"baba\n"' . "\t\t\t\n" . '"gugu"' ) ); 74 $this->assertSame( $this->a90, $po->unpoify( $this->po_a90 ) ); 75 $this->assertSame( '\\t\\n', $po->unpoify( '"\\\\t\\\\n"' ) ); 76 76 // Wordwrapped. 77 $this->assert Equals( 'babadyado', $po->unpoify( "\"\"\n\"baba\"\n\"dyado\"" ) );78 $this->assert EqualsIgnoreEOL( $this->mail, $po->unpoify( $this->po_mail ) );77 $this->assertSame( 'babadyado', $po->unpoify( "\"\"\n\"baba\"\n\"dyado\"" ) ); 78 $this->assertSameIgnoreEOL( $this->mail, $po->unpoify( $this->po_mail ) ); 79 79 } 80 80 … … 82 82 $po = new PO(); 83 83 $entry = new Translation_Entry( array( 'singular' => 'baba' ) ); 84 $this->assert Equals( "msgid \"baba\"\nmsgstr \"\"", $po->export_entry( $entry ) );84 $this->assertSame( "msgid \"baba\"\nmsgstr \"\"", $po->export_entry( $entry ) ); 85 85 // Plural. 86 86 $entry = new Translation_Entry( … … 90 90 ) 91 91 ); 92 $this->assert EqualsIgnoreEOL(92 $this->assertSameIgnoreEOL( 93 93 'msgid "baba" 94 94 msgid_plural "babas" … … 103 103 ) 104 104 ); 105 $this->assert EqualsIgnoreEOL(105 $this->assertSameIgnoreEOL( 106 106 '# baba 107 107 # dyado … … 116 116 ) 117 117 ); 118 $this->assert EqualsIgnoreEOL(118 $this->assertSameIgnoreEOL( 119 119 '#. baba 120 120 msgid "baba" … … 129 129 ) 130 130 ); 131 $this->assert EqualsIgnoreEOL(131 $this->assertSameIgnoreEOL( 132 132 '#. baba 133 133 #: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 … … 143 143 ) 144 144 ); 145 $this->assert Equals( "msgid \"baba\"\nmsgstr \"\"", $po->export_entry( $entry ) );145 $this->assertSame( "msgid \"baba\"\nmsgstr \"\"", $po->export_entry( $entry ) ); 146 146 147 147 $entry = new Translation_Entry( … … 151 151 ) 152 152 ); 153 $this->assert Equals( "msgid \"baba\"\nmsgstr \"куку\"", $po->export_entry( $entry ) );153 $this->assertSame( "msgid \"baba\"\nmsgstr \"куку\"", $po->export_entry( $entry ) ); 154 154 155 155 $entry = new Translation_Entry( … … 160 160 ) 161 161 ); 162 $this->assert EqualsIgnoreEOL(162 $this->assertSameIgnoreEOL( 163 163 'msgid "baba" 164 164 msgid_plural "babas" … … 174 174 ) 175 175 ); 176 $this->assert EqualsIgnoreEOL(176 $this->assertSameIgnoreEOL( 177 177 'msgid "baba" 178 178 msgid_plural "babas" … … 192 192 ) 193 193 ); 194 $this->assert EqualsIgnoreEOL(194 $this->assertSameIgnoreEOL( 195 195 '#, fuzzy, php-format 196 196 msgctxt "ctxt" … … 210 210 $po->add_entry( $entry ); 211 211 $po->add_entry( $entry2 ); 212 $this->assert Equals( "msgid \"baba\"\nmsgstr \"\"\n\nmsgid \"dyado\"\nmsgstr \"\"", $po->export_entries() );212 $this->assertSame( "msgid \"baba\"\nmsgstr \"\"\n\nmsgid \"dyado\"\nmsgstr \"\"", $po->export_entries() ); 213 213 } 214 214 … … 217 217 $po->set_header( 'Project-Id-Version', 'WordPress 2.6-bleeding' ); 218 218 $po->set_header( 'POT-Creation-Date', '2008-04-08 18:00+0000' ); 219 $this->assert Equals( "msgid \"\"\nmsgstr \"\"\n\"Project-Id-Version: WordPress 2.6-bleeding\\n\"\n\"POT-Creation-Date: 2008-04-08 18:00+0000\\n\"", $po->export_headers() );219 $this->assertSame( "msgid \"\"\nmsgstr \"\"\n\"Project-Id-Version: WordPress 2.6-bleeding\\n\"\n\"POT-Creation-Date: 2008-04-08 18:00+0000\\n\"", $po->export_headers() ); 220 220 } 221 221 … … 228 228 $po->add_entry( $entry ); 229 229 $po->add_entry( $entry2 ); 230 $this->assert Equals( "msgid \"baba\"\nmsgstr \"\"\n\nmsgid \"dyado\"\nmsgstr \"\"", $po->export( false ) );231 $this->assert Equals( "msgid \"\"\nmsgstr \"\"\n\"Project-Id-Version: WordPress 2.6-bleeding\\n\"\n\"POT-Creation-Date: 2008-04-08 18:00+0000\\n\"\n\nmsgid \"baba\"\nmsgstr \"\"\n\nmsgid \"dyado\"\nmsgstr \"\"", $po->export() );230 $this->assertSame( "msgid \"baba\"\nmsgstr \"\"\n\nmsgid \"dyado\"\nmsgstr \"\"", $po->export( false ) ); 231 $this->assertSame( "msgid \"\"\nmsgstr \"\"\n\"Project-Id-Version: WordPress 2.6-bleeding\\n\"\n\"POT-Creation-Date: 2008-04-08 18:00+0000\\n\"\n\nmsgid \"baba\"\nmsgstr \"\"\n\nmsgid \"dyado\"\nmsgstr \"\"", $po->export() ); 232 232 } 233 233 … … 244 244 $temp_fn = $this->temp_filename(); 245 245 $po->export_to_file( $temp_fn, false ); 246 $this->assert Equals( $po->export( false ), file_get_contents( $temp_fn ) );246 $this->assertSame( $po->export( false ), file_get_contents( $temp_fn ) ); 247 247 248 248 $temp_fn2 = $this->temp_filename(); 249 249 $po->export_to_file( $temp_fn2 ); 250 $this->assert Equals( $po->export(), file_get_contents( $temp_fn2 ) );250 $this->assertSame( $po->export(), file_get_contents( $temp_fn2 ) ); 251 251 } 252 252 … … 254 254 $po = new PO(); 255 255 $res = $po->import_from_file( DIR_TESTDATA . '/pomo/simple.po' ); 256 $this->assert Equals( true,$res );257 258 $this->assert Equals(256 $this->assertTrue( $res ); 257 258 $this->assertSame( 259 259 array( 260 260 'Project-Id-Version' => 'WordPress 2.6-bleeding', … … 318 318 $po = new PO(); 319 319 $this->assertTrue( $po->import_from_file( DIR_TESTDATA . '/pomo/windows-line-endings.po' ) ); 320 $this->assert Equals( 1, count( $po->entries ) );320 $this->assertSame( 1, count( $po->entries ) ); 321 321 } 322 322
Note: See TracChangeset
for help on using the changeset viewer.