Nav apraksta

StrictUnifiedDiffOutputBuilderDataProvider.php 3.3KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190
  1. <?php declare(strict_types=1);
  2. /*
  3. * This file is part of sebastian/diff.
  4. *
  5. * (c) Sebastian Bergmann <sebastian@phpunit.de>
  6. *
  7. * For the full copyright and license information, please view the LICENSE
  8. * file that was distributed with this source code.
  9. */
  10. namespace SebastianBergmann\Diff\Output;
  11. final class StrictUnifiedDiffOutputBuilderDataProvider
  12. {
  13. public static function provideOutputBuildingCases(): array
  14. {
  15. return [
  16. [
  17. '--- input.txt
  18. +++ output.txt
  19. @@ -1,3 +1,4 @@
  20. +b
  21. ' . '
  22. ' . '
  23. ' . '
  24. @@ -16,5 +17,4 @@
  25. ' . '
  26. ' . '
  27. ' . '
  28. -
  29. -B
  30. +A
  31. ',
  32. "\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\nB\n",
  33. "b\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\nA\n",
  34. [
  35. 'fromFile' => 'input.txt',
  36. 'toFile' => 'output.txt',
  37. ],
  38. ],
  39. [
  40. '--- ' . __FILE__ . "\t2017-10-02 17:38:11.586413675 +0100
  41. +++ output1.txt\t2017-10-03 12:09:43.086719482 +0100
  42. @@ -1,1 +1,1 @@
  43. -B
  44. +X
  45. ",
  46. "B\n",
  47. "X\n",
  48. [
  49. 'fromFile' => __FILE__,
  50. 'fromFileDate' => '2017-10-02 17:38:11.586413675 +0100',
  51. 'toFile' => 'output1.txt',
  52. 'toFileDate' => '2017-10-03 12:09:43.086719482 +0100',
  53. 'collapseRanges' => false,
  54. ],
  55. ],
  56. [
  57. '--- input.txt
  58. +++ output.txt
  59. @@ -1 +1 @@
  60. -B
  61. +X
  62. ',
  63. "B\n",
  64. "X\n",
  65. [
  66. 'fromFile' => 'input.txt',
  67. 'toFile' => 'output.txt',
  68. 'collapseRanges' => true,
  69. ],
  70. ],
  71. ];
  72. }
  73. public static function provideSample(): array
  74. {
  75. return [
  76. [
  77. '--- input.txt
  78. +++ output.txt
  79. @@ -1,6 +1,6 @@
  80. 1
  81. 2
  82. 3
  83. -4
  84. +X
  85. 5
  86. 6
  87. ',
  88. "1\n2\n3\n4\n5\n6\n",
  89. "1\n2\n3\nX\n5\n6\n",
  90. [
  91. 'fromFile' => 'input.txt',
  92. 'toFile' => 'output.txt',
  93. ],
  94. ],
  95. ];
  96. }
  97. public static function provideBasicDiffGeneration(): array
  98. {
  99. return [
  100. [
  101. "--- input.txt
  102. +++ output.txt
  103. @@ -1,2 +1 @@
  104. -A
  105. -B
  106. +A\rB
  107. ",
  108. "A\nB\n",
  109. "A\rB\n",
  110. ],
  111. [
  112. "--- input.txt
  113. +++ output.txt
  114. @@ -1 +1 @@
  115. -
  116. +\r
  117. \\ No newline at end of file
  118. ",
  119. "\n",
  120. "\r",
  121. ],
  122. [
  123. "--- input.txt
  124. +++ output.txt
  125. @@ -1 +1 @@
  126. -\r
  127. \\ No newline at end of file
  128. +
  129. ",
  130. "\r",
  131. "\n",
  132. ],
  133. [
  134. '--- input.txt
  135. +++ output.txt
  136. @@ -1,3 +1,3 @@
  137. X
  138. A
  139. -A
  140. +B
  141. ',
  142. "X\nA\nA\n",
  143. "X\nA\nB\n",
  144. ],
  145. [
  146. '--- input.txt
  147. +++ output.txt
  148. @@ -1,3 +1,3 @@
  149. X
  150. A
  151. -A
  152. \ No newline at end of file
  153. +B
  154. ',
  155. "X\nA\nA",
  156. "X\nA\nB\n",
  157. ],
  158. [
  159. '--- input.txt
  160. +++ output.txt
  161. @@ -1,3 +1,3 @@
  162. A
  163. A
  164. -A
  165. +B
  166. \ No newline at end of file
  167. ',
  168. "A\nA\nA\n",
  169. "A\nA\nB",
  170. ],
  171. [
  172. '--- input.txt
  173. +++ output.txt
  174. @@ -1 +1 @@
  175. -A
  176. \ No newline at end of file
  177. +B
  178. \ No newline at end of file
  179. ',
  180. 'A',
  181. 'B',
  182. ],
  183. ];
  184. }
  185. }