File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -92,7 +92,7 @@ public function getOutput(): ?string
9292 public function getErrorOutput (): ?string
9393 {
9494 if (isset ($ this ->data ['Stderr ' ])) {
95- return $ this ->data ['Stderr ' ] ?: $ this -> data [ ' Stdout ' ] ;
95+ return $ this ->data ['Stderr ' ];
9696 }
9797
9898 if (isset ($ this ->data ['ErrorMsg ' ])) {
Original file line number Diff line number Diff line change @@ -66,4 +66,35 @@ public function testSuccessful()
6666 $ this ->assertNull ($ taskReport ->getErrorOutput ());
6767 $ this ->assertEquals ('output ' , $ taskReport ->getOutput ());
6868 }
69+
70+ public function testNotSuccessfulWithoutStdout ()
71+ {
72+ $ taskReport = new TaskReport (
73+ [
74+ 'Type ' => TaskReport::TYPE_REPLY ,
75+ 'Success ' => false ,
76+ 'Stderr ' => 'error ' ,
77+ ],
78+ new Task (['Action ' => 'ssh ' , 'Cmd ' => 'ls -al ' ])
79+ );
80+
81+ $ this ->assertFalse ($ taskReport ->isSuccessful ());
82+ $ this ->assertEquals ('error ' , $ taskReport ->getErrorOutput ());
83+ $ this ->assertNull ($ taskReport ->getOutput ());
84+ }
85+
86+ public function testNotSuccessfulWithoutStderr ()
87+ {
88+ $ taskReport = new TaskReport (
89+ [
90+ 'Type ' => TaskReport::TYPE_REPLY ,
91+ 'Success ' => false ,
92+ ],
93+ new Task (['Action ' => 'ssh ' , 'Cmd ' => 'ls -al ' ])
94+ );
95+
96+ $ this ->assertFalse ($ taskReport ->isSuccessful ());
97+ $ this ->assertNull ($ taskReport ->getErrorOutput ());
98+ $ this ->assertNull ($ taskReport ->getOutput ());
99+ }
69100}
You can’t perform that action at this time.
0 commit comments