Changeset 54315
- Timestamp:
- 09/26/2022 08:54:44 PM (2 years ago)
- Location:
- trunk
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/pomo/entry.php
r54133 r54315 88 88 * Generates a unique key for this entry. 89 89 * 90 * @return string|false The key or false if the entry is empty.90 * @return string|false The key or false if the entry is null. 91 91 */ 92 92 public function key() { 93 if ( null === $this->singular || '' === $this->singular) {93 if ( null === $this->singular ) { 94 94 return false; 95 95 } -
trunk/tests/phpunit/tests/pomo/translations.php
r52010 r54315 128 128 } 129 129 130 /** 131 * @ticket 55941 132 */ 133 public function test_translate_falsy_key() { 134 $entry_empty = new Translation_Entry( 135 array( 136 'singular' => '', 137 'translations' => array( 138 '', 139 ), 140 ) 141 ); 142 $entry_zero = new Translation_Entry( 143 array( 144 'singular' => '0', 145 'translations' => array( 146 '0', 147 ), 148 ) 149 ); 150 $po = new Translations(); 151 $po->add_entry( $entry_empty ); 152 $po->add_entry( $entry_zero ); 153 154 $this->assertSame( '', $po->translate( '' ) ); 155 $this->assertSame( '0', $po->translate( '0' ) ); 156 } 130 157 }
Note: See TracChangeset
for help on using the changeset viewer.