Due to count($post->reactions) === 0, I guess there is no real nice solution to this. Currently, I've solved it by adding a method in Tests/TestCase. Something like this:
/**
* Calls a route with a POST call and a given body.
*
* @param string $route
* @param string $body
* @param array $routeParams
*
* @return TestResponse
*/
protected function postXml(string $route, string $body = '', array $routeParams = []): TestResponse
{
return $this->call('POST', route($route, $routeParams), [], [], [], [], $body);
}
This is a stripped version of what I use in my scenario. In my case, I've also got some header variables and stuff like that making the helper a bit more useful. When looking at the stripped example here you could argue creating a helper can be a bit overkill. It depends on your coding style I guess.