JohnRivs
1 month ago
236
2
Testing

Calling TestCase methods within a response macro?

Posted 1 month ago by JohnRivs

I have this situation where I want to create a macro for this response:

$this->patch('some-path')->assertSomething();

From this macro, I wanna call some things on $this but at this point, $this is no longer the test class; it's a TestResponse.

\Illuminate\Testing\TestResponse::macro('assertSomething', function () {
	// I can no longer do the following.
	$this->withoutExceptionHandling();
});

How can I get access to the test class?

Please sign in or create an account to participate in this conversation.