Changeset 59105
- Timestamp:
- 09/27/2024 05:51:49 PM (9 months ago)
- Location:
- trunk
- Files:
-
- 1 added
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/Text/Diff.php
r59070 r59105 261 261 { 262 262 if (serialize($from_lines) != serialize($this->getOriginal())) { 263 t rigger_error("Reconstructed original does not match", E_USER_ERROR);263 throw new Text_Exception("Reconstructed original does not match"); 264 264 } 265 265 if (serialize($to_lines) != serialize($this->getFinal())) { 266 t rigger_error("Reconstructed final does not match", E_USER_ERROR);266 throw new Text_Exception("Reconstructed final does not match"); 267 267 } 268 268 269 269 $rev = $this->reverse(); 270 270 if (serialize($to_lines) != serialize($rev->getOriginal())) { 271 t rigger_error("Reversed original does not match", E_USER_ERROR);271 throw new Text_Exception("Reversed original does not match"); 272 272 } 273 273 if (serialize($from_lines) != serialize($rev->getFinal())) { 274 t rigger_error("Reversed final does not match", E_USER_ERROR);274 throw new Text_Exception("Reversed final does not match"); 275 275 } 276 276 … … 278 278 foreach ($this->_edits as $edit) { 279 279 if ($prevtype !== null && $edit instanceof $prevtype) { 280 t rigger_error("Edit sequence is non-optimal", E_USER_ERROR);280 throw new Text_Exception("Edit sequence is non-optimal"); 281 281 } 282 282 $prevtype = get_class($edit); -
trunk/src/wp-includes/wp-diff.php
r47198 r59105 16 16 /** Text_Diff_Renderer_inline class */ 17 17 require ABSPATH . WPINC . '/Text/Diff/Renderer/inline.php'; 18 /** Text_Exception class */ 19 require ABSPATH . WPINC . '/Text/Exception.php'; 18 20 } 19 21 -
trunk/tests/phpunit/tests/diff/Text_Diff_Check_Test.php
r59070 r59105 24 24 public static function set_up_before_class() { 25 25 require_once ABSPATH . 'wp-includes/Text/Diff.php'; 26 require_once ABSPATH . 'wp-includes/Text/Exception.php'; 26 27 } 27 28 … … 35 36 $this->assertTrue( $diff->_check( self::FILE_A, self::FILE_B ) ); 36 37 } 38 39 public function test_check_throws_exception_when_from_is_not_same_as_original() { 40 $this->expectException( Text_Exception::class ); 41 $this->expectExceptionMessage( 'Reconstructed original does not match' ); 42 43 $diff = new Text_Diff( 'auto', array( self::FILE_A, self::FILE_B ) ); 44 $diff->_check( self::FILE_B, self::FILE_B ); 45 } 46 47 public function test_check_throws_exception_when_to_is_not_same_as_final() { 48 $this->expectException( Text_Exception::class ); 49 $this->expectExceptionMessage( 'Reconstructed final does not match' ); 50 51 $diff = new Text_Diff( 'auto', array( self::FILE_A, self::FILE_B ) ); 52 $diff->_check( self::FILE_A, self::FILE_A ); 53 } 37 54 }
Note: See TracChangeset
for help on using the changeset viewer.