@@ -21,9 +21,9 @@ class ExceptionCasterTest extends \PHPUnit_Framework_TestCase
21
21
{
22
22
use VarDumperTestTrait;
23
23
24
- private function getTestException ()
24
+ private function getTestException ($ msg , & $ ref = null )
25
25
{
26
- return new \Exception ('foo ' );
26
+ return new \Exception ('' . $ msg );
27
27
}
28
28
29
29
protected function tearDown ()
@@ -34,7 +34,8 @@ protected function tearDown()
34
34
35
35
public function testDefaultSettings ()
36
36
{
37
- $ e = $ this ->getTestException ($ this );
37
+ $ ref = array ('foo ' );
38
+ $ e = $ this ->getTestException ('foo ' , $ ref );
38
39
39
40
$ expectedDump = <<<'EODUMP'
40
41
Exception {
@@ -45,21 +46,23 @@ public function testDefaultSettings()
45
46
-trace: {
46
47
%sExceptionCasterTest.php:26: {
47
48
: {
48
- : return new \Exception('foo' );
49
+ : return new \Exception(''.$msg );
49
50
: }
50
51
}
51
52
%sExceptionCasterTest.php:%d: {
52
- : {
53
- : $e = $this->getTestException($this );
53
+ : $ref = array('foo');
54
+ : $e = $this->getTestException('foo', $ref );
54
55
:
55
56
arguments: {
56
- Symfony\Component\VarDumper\Tests\Caster\ExceptionCasterTest {#1 …}
57
+ $msg: "foo"
58
+ &$ref: array:1 [ …1]
57
59
}
58
60
}
59
61
%A
60
62
EODUMP;
61
63
62
64
$ this ->assertDumpMatchesFormat ($ expectedDump , $ e );
65
+ $ this ->assertSame (array ('foo ' ), $ ref );
63
66
}
64
67
65
68
public function testSeek ()
@@ -70,15 +73,15 @@ public function testSeek()
70
73
{
71
74
%sExceptionCasterTest.php:26: {
72
75
: {
73
- : return new \Exception('foo' );
76
+ : return new \Exception(''.$msg );
74
77
: }
75
78
}
76
79
%sExceptionCasterTest.php:%d: {
77
80
: {
78
81
: $e = $this->getTestException(2);
79
82
:
80
83
arguments: {
81
- 2
84
+ $msg: 2
82
85
}
83
86
}
84
87
%A
@@ -94,14 +97,14 @@ public function testNoArgs()
94
97
95
98
$ expectedDump = <<<'EODUMP'
96
99
Exception {
97
- #message: "foo "
<
DA37
/td>
100
+ #message: "1 "
98
101
#code: 0
99
102
#file: "%sExceptionCasterTest.php"
100
103
#line: 26
101
104
-trace: {
102
105
%sExceptionCasterTest.php:26: {
103
106
: {
104
- : return new \Exception('foo' );
107
+ : return new \Exception(''.$msg );
105
108
: }
106
109
}
107
110
%sExceptionCasterTest.php:%d: {
@@ -122,7 +125,7 @@ public function testNoSrcContext()
122
125
123
126
$ expectedDump = <<<'EODUMP'
124
127
Exception {
125
- #message: "foo "
128
+ #message: "1 "
126
129
#code: 0
127
130
#file: "%sExceptionCasterTest.php"
128
131
#line: 26
@@ -149,7 +152,7 @@ public function testHtmlDump()
149
152
150
153
$ expectedDump = <<<'EODUMP'
151
154
<foo></foo><bar><span class=sf-dump-note>Exception</span> {<samp>
152
- #<span class=sf-dump-protected title="Protected property">message</span>: "<span class=sf-dump-str title="3 characters">foo </span>"
155
+ #<span class=sf-dump-protected title="Protected property">message</span>: "<span class=sf-dump-str>1 </span>"
153
156
#<span class=sf-dump-protected title="Protected property">code</span>: <span class=sf-dump-num>0</span>
154
157
#<span class=sf-dump-protected title="Protected property">file</span>: "<span class=sf-dump-str title="%sExceptionCasterTest.php
155
158
%d characters"><span class=sf-dump-ellipsis>%sTests</span>%eCaster%eExceptionCasterTest.php</span>"
0 commit comments