comparison vendor/sebastian/comparator/src/ComparisonFailure.php @ 14:1fec387a4317

Update Drupal core to 8.5.2 via Composer
author Chris Cannam
date Mon, 23 Apr 2018 09:46:53 +0100
parents 4c8ae668cc8c
children
comparison
equal deleted inserted replaced
13:5fb285c0d0e3 14:1fec387a4317
1 <?php 1 <?php
2 /* 2 /*
3 * This file is part of the Comparator package. 3 * This file is part of sebastian/comparator.
4 * 4 *
5 * (c) Sebastian Bergmann <sebastian@phpunit.de> 5 * (c) Sebastian Bergmann <sebastian@phpunit.de>
6 * 6 *
7 * For the full copyright and license information, please view the LICENSE 7 * For the full copyright and license information, please view the LICENSE
8 * file that was distributed with this source code. 8 * file that was distributed with this source code.
9 */ 9 */
10 10
11 namespace SebastianBergmann\Comparator; 11 namespace SebastianBergmann\Comparator;
12 12
13 use SebastianBergmann\Diff\Differ; 13 use SebastianBergmann\Diff\Differ;
14 use SebastianBergmann\Diff\Output\UnifiedDiffOutputBuilder;
14 15
15 /** 16 /**
16 * Thrown when an assertion for string equality failed. 17 * Thrown when an assertion for string equality failed.
17 */ 18 */
18 class ComparisonFailure extends \RuntimeException 19 class ComparisonFailure extends \RuntimeException
19 { 20 {
20 /** 21 /**
21 * Expected value of the retrieval which does not match $actual. 22 * Expected value of the retrieval which does not match $actual.
23 *
22 * @var mixed 24 * @var mixed
23 */ 25 */
24 protected $expected; 26 protected $expected;
25 27
26 /** 28 /**
27 * Actually retrieved value which does not match $expected. 29 * Actually retrieved value which does not match $expected.
30 *
28 * @var mixed 31 * @var mixed
29 */ 32 */
30 protected $actual; 33 protected $actual;
31 34
32 /** 35 /**
33 * The string representation of the expected value 36 * The string representation of the expected value
37 *
34 * @var string 38 * @var string
35 */ 39 */
36 protected $expectedAsString; 40 protected $expectedAsString;
37 41
38 /** 42 /**
39 * The string representation of the actual value 43 * The string representation of the actual value
44 *
40 * @var string 45 * @var string
41 */ 46 */
42 protected $actualAsString; 47 protected $actualAsString;
43 48
44 /** 49 /**
47 protected $identical; 52 protected $identical;
48 53
49 /** 54 /**
50 * Optional message which is placed in front of the first line 55 * Optional message which is placed in front of the first line
51 * returned by toString(). 56 * returned by toString().
57 *
52 * @var string 58 * @var string
53 */ 59 */
54 protected $message; 60 protected $message;
55 61
56 /** 62 /**
112 { 118 {
113 if (!$this->actualAsString && !$this->expectedAsString) { 119 if (!$this->actualAsString && !$this->expectedAsString) {
114 return ''; 120 return '';
115 } 121 }
116 122
117 $differ = new Differ("\n--- Expected\n+++ Actual\n"); 123 $differ = new Differ(new UnifiedDiffOutputBuilder("\n--- Expected\n+++ Actual\n"));
118 124
119 return $differ->diff($this->expectedAsString, $this->actualAsString); 125 return $differ->diff($this->expectedAsString, $this->actualAsString);
120 } 126 }
121 127
122 /** 128 /**