Changeset 53850
- Timestamp:
- 08/07/2022 01:56:35 PM (2 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/tests/phpunit/tests/pomo/po.php
r52010 r53850 6 6 class Tests_POMO_PO extends WP_UnitTestCase { 7 7 8 public static function set_up_before_class() { 9 parent::set_up_before_class(); 10 11 require_once ABSPATH . '/wp-includes/pomo/po.php'; 12 } 13 14 public function set_up() { 15 parent::set_up(); 16 17 // Not so random wordpress.pot string -- multiple lines. 18 $this->mail = 'Your new WordPress blog has been successfully set up at: 8 /** 9 * Mail content. 10 * 11 * @var string 12 */ 13 const MAIL_TEXT = 'Your new WordPress blog has been successfully set up at: 19 14 20 15 %1$s … … 30 25 http://wordpress.org/ 31 26 '; 32 $this->mail = str_replace( "\r\n", "\n", $this->mail ); 33 $this->po_mail = '"" 27 28 /** 29 * Mail content for translation readiness. 30 * 31 * @var string 32 */ 33 const PO_MAIL = '"" 34 34 "Your new WordPress blog has been successfully set up at:\n" 35 35 "\n" … … 45 45 "--The WordPress Team\n" 46 46 "http://wordpress.org/\n"'; 47 $this->a90 = str_repeat( 'a', 90 ); 48 $this->po_a90 = "\"$this->a90\""; 47 48 public static function set_up_before_class() { 49 parent::set_up_before_class(); 50 51 require_once ABSPATH . '/wp-includes/pomo/po.php'; 49 52 } 50 53 … … 61 64 $this->assertSame( '"baba"', $po->poify( 'baba' ) ); 62 65 // Long word. 63 $this->assertSame( $this->po_a90, $po->poify( $this->a90 ) ); 66 $long_word = str_repeat( 'a', 90 ); 67 $po_long_word = "\"$long_word\""; 68 $this->assertSame( $po_long_word, $po->poify( $long_word ) ); 64 69 // Tab. 65 70 $this->assertSame( '"ba\tba"', $po->poify( "ba\tba" ) ); … … 72 77 $this->assertSame( '"Categories can be selectively converted to tags using the <a href=\\"%s\\">category to tag converter</a>."', $po->poify( $src ) ); 73 78 74 $this->assertSameIgnoreEOL( $this->po_mail, $po->poify( $this->mail ) ); 79 $mail = str_replace( "\r\n", "\n", self::MAIL_TEXT ); 80 $this->assertSameIgnoreEOL( self::PO_MAIL, $po->poify( $mail ) ); 75 81 } 76 82 … … 79 85 $this->assertSame( 'baba', $po->unpoify( '"baba"' ) ); 80 86 $this->assertSame( "baba\ngugu", $po->unpoify( '"baba\n"' . "\t\t\t\n" . '"gugu"' ) ); 81 $this->assertSame( $this->a90, $po->unpoify( $this->po_a90 ) ); 87 88 $long_word = str_repeat( 'a', 90 ); 89 $po_long_word = "\"$long_word\""; 90 $this->assertSame( $long_word, $po->unpoify( $po_long_word ) ); 82 91 $this->assertSame( '\\t\\n', $po->unpoify( '"\\\\t\\\\n"' ) ); 83 92 // Wordwrapped. 84 93 $this->assertSame( 'babadyado', $po->unpoify( "\"\"\n\"baba\"\n\"dyado\"" ) ); 85 $this->assertSameIgnoreEOL( $this->mail, $po->unpoify( $this->po_mail ) ); 94 95 $mail = str_replace( "\r\n", "\n", self::MAIL_TEXT ); 96 $this->assertSameIgnoreEOL( $mail, $po->unpoify( self::PO_MAIL ) ); 86 97 } 87 98
Note: See TracChangeset
for help on using the changeset viewer.