@@ -51,10 +51,11 @@ public function testProcessFailedExceptionPopulatesInformationFromProcessOutput(
51
51
$ exitText = 'General error ' ;
52
52
$ output = 'Command output ' ;
53
53
$ errorOutput = 'FATAL: Unexpected error ' ;
54
+ $ workingDirectory = getcwd ();
54
55
55
56
$ process = $ this ->getMock (
56
57
'Symfony\Component\Process\Process ' ,
57
- array ('isSuccessful ' , 'getOutput ' , 'getErrorOutput ' , 'getExitCode ' , 'getExitCodeText ' , 'isOutputDisabled ' ),
58
+ array ('isSuccessful ' , 'getOutput ' , 'getErrorOutput ' , 'getExitCode ' , 'getExitCodeText ' , 'isOutputDisabled ' , ' getWorkingDirectory ' ),
58
59
array ($ cmd )
59
60
);
60
61
$ process ->expects ($ this ->once ())
@@ -81,10 +82,14 @@ public function testProcessFailedExceptionPopulatesInformationFromProcessOutput(
81
82
->method ('isOutputDisabled ' )
82
83
->will ($ this ->returnValue (false ));
83
84
85
+ $ process ->expects ($ this ->once ())
86
+ ->method ('getWorkingDirectory ' )
87
+ ->will ($ this ->returnValue ($ workingDirectory ));
88
+
84
89
$ exception = new ProcessFailedException ($ process );
85
90
86
91
$ this ->assertEquals (
87
- "The command \"$ cmd \" failed. \nExit Code: $ exitCode( $ exitText) \n\nOutput: \n================ \n{$ output }\n\nError Output: \n================ \n{$ errorOutput }" ,
92
+ "The command \"$ cmd \" failed. \n\ nExit Code: $ exitCode( $ exitText) \n\n Working directory: { $ workingDirectory } \n\nOutput: \n================ \n{$ output }\n\nError Output: \n================ \n{$ errorOutput }" ,
88
93
$ exception ->getMessage ()
89
94
);
90
95
}
@@ -98,10 +103,11 @@ public function testDisabledOutputInFailedExceptionDoesNotPopulateOutput()
98
103
$ cmd = 'php ' ;
99
104
$ exitCode = 1 ;
100
105
$ exitText = 'General error ' ;
101
-
106
+ $ workingDirectory = getcwd ();
107
+
102
108
$ process = $ this ->getMock (
103
109
'Symfony\Component\Process\Process ' ,
104
- array ('isSuccessful ' , 'isOutputDisabled ' , 'getExitCode ' , 'getExitCodeText ' , 'getOutput ' , 'getErrorOutput ' ),
110
+ array ('isSuccessful ' , 'isOutputDisabled ' , 'getExitCode ' , 'getExitCodeText ' , 'getOutput ' , 'getErrorOutput ' , ' getWorkingDirectory ' ),
105
111
array ($ cmd )
106
112
);
107
113
$ process ->expects ($ this ->once ())
@@ -125,11 +131,15 @@ public function testDisabledOutputInFailedExceptionDoesNotPopulateOutput()
125
131
$ process ->expects ($ this ->once ())
126
132
->method ('isOutputDisabled ' )
127
133
->will ($ this ->returnValue (true ));
134
+
135
+ $ process ->expects ($ this ->once ())
136
+ ->method ('getWorkingDirectory ' )
137
+ ->will ($ this ->returnValue ($ workingDirectory ));
128
138
129
139
$ exception = new ProcessFailedException ($ process );
130
140
131
141
$ this ->assertEquals (
132
- "The command \"$ cmd \" failed. \nExit Code: $ exitCode( $ exitText) " ,
142
+ "The command \"$ cmd \" failed. \n\ nExit Code: $ exitCode( $ exitText) \n\n Working directory: { $ workingDirectory } " ,
133
143
$ exception ->getMessage ()
134
144
);
135
145
}
0 commit comments