Skip to content

Commit 3a5cdd1

Browse files
committed
Fix expectWarning usage
1 parent 3ffb098 commit 3a5cdd1

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

tests/Test_Arguments.php

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,13 @@ public function set_up()
9090
'flags' => $this->flags,
9191
'options' => $this->options
9292
);
93+
94+
set_error_handler(
95+
static function ( $errno, $errstr ) {
96+
throw new \Exception( $errstr, $errno );
97+
},
98+
E_ALL
99+
);
93100
}
94101

95102
/**
@@ -101,6 +108,7 @@ public function tear_down()
101108
$this->options = null;
102109
$this->settings = null;
103110
self::clearArgv();
111+
restore_error_handler();
104112
}
105113

106114
/**
@@ -258,8 +266,8 @@ public function testParseWithValidOptions($cliParams, $expectedValues)
258266
*/
259267
public function testParseWithMissingOptions($cliParams, $expectedValues)
260268
{
261-
$this->expectWarning();
262-
$this->expectWarningMessage('no value given for --option1');
269+
$this->expectException(\Exception::class);
270+
$this->expectExceptionMessage('no value given for --option1');
263271
$this->_testParse($cliParams, $expectedValues);
264272
}
265273

0 commit comments

Comments
 (0)