44namespace SetBased \Helper \Test ;
55
66use PHPUnit \Framework \TestCase ;
7+ use SetBased \Exception \ProgramExecutionException ;
78use SetBased \Helper \ProgramExecution ;
89
910/**
@@ -25,12 +26,10 @@ public function testExec1AnyExitStatus1(): void
2526 //--------------------------------------------------------------------------------------------------------------------
2627 /**
2728 * Test with failed command and empty allowed exit statuses.
28- *
29- * @expectedException \SetBased\Exception\ProgramExecutionException
3029 */
3130 public function testExec1AnyExitStatus2 (): void
3231 {
33- $ ret = ProgramExecution::exec1 (['false ' ], [] );
32+ $ ret = ProgramExecution::exec1 (['false ' ], null );
3433
3534 $ this ->assertSame (1 , $ ret [1 ]);
3635 }
@@ -41,7 +40,7 @@ public function testExec1AnyExitStatus2(): void
4140 */
4241 public function testExec1BasicUsage (): void
4342 {
44- list ( $ output , $ status) = ProgramExecution::exec1 (['echo ' , 'hello, world! ' ]);
43+ [ $ output , $ status] = ProgramExecution::exec1 (['echo ' , 'hello, world! ' ]);
4544
4645 $ this ->assertSame (0 , $ status );
4746 $ this ->assertSame ($ output , ['hello, world! ' ]);
@@ -50,11 +49,10 @@ public function testExec1BasicUsage(): void
5049 //--------------------------------------------------------------------------------------------------------------------
5150 /**
5251 * Test with failed command.
53- *
54- * @expectedException \SetBased\Exception\ProgramExecutionException
5552 */
5653 public function testExec1ExitStatusFail (): void
5754 {
55+ $ this ->expectException (ProgramExecutionException::class);
5856 ProgramExecution::exec1 (['cmp ' , __FILE__ , 'foogazy ' ], [0 , 1 ]);
5957 }
6058
@@ -92,7 +90,7 @@ public function testExec1TrickyCommand(): void
9290
9391 foreach ($ strings as $ string )
9492 {
95- list ( $ output , $ status) = ProgramExecution::exec1 (['echo ' , $ string ]);
93+ [ $ output , $ status] = ProgramExecution::exec1 (['echo ' , $ string ]);
9694
9795 $ this ->assertSame (0 , $ status );
9896 $ this ->assertSame ($ string , $ output [0 ]);
@@ -130,11 +128,10 @@ public function testExec2BasicUsage(): void
130128 //--------------------------------------------------------------------------------------------------------------------
131129 /**
132130 * Test with failed command.
133- *
134- * @expectedException \SetBased\Exception\ProgramExecutionException
135131 */
136132 public function testExec2ExitStatusFail (): void
137133 {
134+ $ this ->expectException (ProgramExecutionException::class);
138135 ProgramExecution::exec2 (['cmp ' , __FILE__ , 'foogazy ' ], null , '/dev/null ' );
139136 }
140137
0 commit comments