@@ -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,27 +82,32 @@ 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
}
91
96
92
97
/**
93
98
* Tests that ProcessFailedException does not extract information from
94
- * process output if it was previously disabled
99
+ * process output if it was previously disabled.
95
100
*/
96
101
public function testDisabledOutputInFailedExceptionDoesNotPopulateOutput ()
97
102
{
98
103
$ cmd = 'php ' ;
99
104
$ exitCode = 1 ;
100
105
$ exitText = 'General error ' ;
106
+ $ workingDirectory = getcwd ();
101
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 ())
@@ -126,10 +132,14 @@ public function testDisabledOutputInFailedExceptionDoesNotPopulateOutput()
126
132
->method ('isOutputDisabled ' )
127
133
->will ($ this ->returnValue (true ));
128
134
135
+ $ process ->expects ($ this ->once ())
136
+ ->method ('getWorkingDirectory ' )
137
+ ->will ($ this ->returnValue ($ workingDirectory ));
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