mirror of
https://github.com/pestphp/pest.git
synced 2026-03-10 09:47:23 +01:00
Allows you to just specify an exception message when calling throws.
This commit is contained in:
@ -61,9 +61,13 @@ final class TestCall
|
||||
*/
|
||||
public function throws(string $exceptionClass, string $exceptionMessage = null): TestCall
|
||||
{
|
||||
$this->testCaseFactory
|
||||
->proxies
|
||||
->add(Backtrace::file(), Backtrace::line(), 'expectException', [$exceptionClass]);
|
||||
if (class_exists($exceptionClass)) {
|
||||
$this->testCaseFactory
|
||||
->proxies
|
||||
->add(Backtrace::file(), Backtrace::line(), 'expectException', [$exceptionClass]);
|
||||
} else {
|
||||
$exceptionMessage = $exceptionClass;
|
||||
}
|
||||
|
||||
if (is_string($exceptionMessage)) {
|
||||
$this->testCaseFactory
|
||||
|
||||
Reference in New Issue
Block a user