b2evolution PHP Cross Reference Blogging Systems

Source: /inc/_ext/phpsvnclient/ext/Diff/tests/string.phpt - 145 lines - 3749 bytes - Text - Print

   1  --TEST--
   2  Text_Diff: Text_Diff_Engine_string test.
   3  --FILE--
   4  <?php
   5  
   6  require_once 'PEAR.php';
   7  require_once 'Text/Diff.php';
   8  
   9  $unified = file_get_contents(dirname(__FILE__) . '/unified.patch');
  10  $diff_u = new Text_Diff('string', array($unified));
  11  echo strtolower(print_r($diff_u, true));
  12  
  13  $unified2 = file_get_contents(dirname(__FILE__) . '/unified2.patch');
  14  $diff_u2 = new Text_Diff('string', array($unified2));
  15  var_export(is_a($diff_u2->getDiff(), 'PEAR_Error'));
  16  echo "\n";
  17  $diff_u2 = new Text_Diff('string', array($unified2, 'unified'));
  18  echo strtolower(print_r($diff_u2, true));
  19  
  20  $context = file_get_contents(dirname(__FILE__) . '/context.patch');
  21  $diff_c = new Text_Diff('string', array($context));
  22  echo strtolower(print_r($diff_c, true));
  23  
  24  ?>
  25  --EXPECT--
  26  text_diff object
  27  (
  28      [_edits] => array
  29          (
  30              [0] => text_diff_op_copy object
  31                  (
  32                      [orig] => array
  33                          (
  34                              [0] => this line is the same.
  35                          )
  36  
  37                      [final] => array
  38                          (
  39                              [0] => this line is the same.
  40                          )
  41  
  42                  )
  43  
  44              [1] => text_diff_op_change object
  45                  (
  46                      [orig] => array
  47                          (
  48                              [0] => this line is different in 1.txt
  49                          )
  50  
  51                      [final] => array
  52                          (
  53                              [0] => this line is different in 2.txt
  54                          )
  55  
  56                  )
  57  
  58              [2] => text_diff_op_copy object
  59                  (
  60                      [orig] => array
  61                          (
  62                              [0] => this line is the same.
  63                          )
  64  
  65                      [final] => array
  66                          (
  67                              [0] => this line is the same.
  68                          )
  69  
  70                  )
  71  
  72          )
  73  
  74  )
  75  true
  76  text_diff object
  77  (
  78      [_edits] => array
  79          (
  80              [0] => text_diff_op_change object
  81                  (
  82                      [orig] => array
  83                          (
  84                              [0] => for the first time in u.s. history number of private contractors and troops are equal
  85                          )
  86  
  87                      [final] => array
  88                          (
  89                              [0] => number of private contractors and troops are equal for first time in u.s. history
  90                          )
  91  
  92                  )
  93  
  94          )
  95  
  96  )
  97  text_diff object
  98  (
  99      [_edits] => array
 100          (
 101              [0] => text_diff_op_copy object
 102                  (
 103                      [orig] => array
 104                          (
 105                              [0] => this line is the same.
 106                          )
 107  
 108                      [final] => array
 109                          (
 110                              [0] => this line is the same.
 111                          )
 112  
 113                  )
 114  
 115              [1] => text_diff_op_change object
 116                  (
 117                      [orig] => array
 118                          (
 119                              [0] => this line is different in 1.txt
 120                          )
 121  
 122                      [final] => array
 123                          (
 124                              [0] => this line is different in 2.txt
 125                          )
 126  
 127                  )
 128  
 129              [2] => text_diff_op_copy object
 130                  (
 131                      [orig] => array
 132                          (
 133                              [0] => this line is the same.
 134                          )
 135  
 136                      [final] => array
 137                          (
 138                              [0] => this line is the same.
 139                          )
 140  
 141                  )
 142  
 143          )
 144  
 145  )

title

Description

title

Description

title

Description

title

title

Body