Skip to content

Commit

Permalink
Fix expectWarning usage
Browse files Browse the repository at this point in the history
  • Loading branch information
swissspidy committed May 22, 2024
1 parent 3ffb098 commit 3a5cdd1
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions tests/Test_Arguments.php
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,13 @@ public function set_up()
'flags' => $this->flags,
'options' => $this->options
);

set_error_handler(
static function ( $errno, $errstr ) {
throw new \Exception( $errstr, $errno );
},
E_ALL
);
}

/**
Expand All @@ -101,6 +108,7 @@ public function tear_down()
$this->options = null;
$this->settings = null;
self::clearArgv();
restore_error_handler();
}

/**
Expand Down Expand Up @@ -258,8 +266,8 @@ public function testParseWithValidOptions($cliParams, $expectedValues)
*/
public function testParseWithMissingOptions($cliParams, $expectedValues)
{
$this->expectWarning();
$this->expectWarningMessage('no value given for --option1');
$this->expectException(\Exception::class);
$this->expectExceptionMessage('no value given for --option1');
$this->_testParse($cliParams, $expectedValues);
}

Expand Down

0 comments on commit 3a5cdd1

Please sign in to comment.