Skip to content

Commit

Permalink
Add throw function
Browse files Browse the repository at this point in the history
  • Loading branch information
HillLiu committed Apr 3, 2021
1 parent 28b169f commit 8c245ef
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions src/TestCase.php
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,18 @@ protected function haveString($needle, $haystack)
}
}

protected function throw($willThrow, $error = true)
{
$traces = debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS, 2);
$func = $traces[1]['function'];
\PMVC\plug('unit')->throw(
$willThrow,
[$this, $func],
$this,
$error
);
}

public function testNone()
{
$this->assertFalse(false);
Expand Down

0 comments on commit 8c245ef

Please sign in to comment.