Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Fix expectWarning usage
  • Loading branch information
swissspidy committed May 22, 2024
commit 3a5cdd13d75ba094e5c35091e72d6334c0cbbbf3
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