One possible solution is to create a custom assertion method in your test case that checks if the raw payload was pushed to the SQS queue. Here's an example:
use Illuminate\Support\Facades\Queue;
use PHPUnit\Framework\Assert;
class ExampleTest extends TestCase
{
public function testPushRawToSqs()
{
Queue::fake();
$payload = 'some raw payload';
Queue::connection('sqs')->pushRaw($payload);
Assert::assertTrue(Queue::connection('sqs')->assertPushed(function ($job) use ($payload) {
return $job->payload() === $payload;
}));
}
}
In this example, we first fake the queue using Queue::fake(). Then we push a raw payload to the SQS queue using Queue::connection('sqs')->pushRaw($payload). Finally, we use Queue::connection('sqs')->assertPushed() to check if the payload was pushed to the queue. The assertPushed() method takes a closure that receives the job instance and should return a boolean indicating if the job matches the expected payload. In this case, we check if the payload of the job is equal to the original payload we pushed.
Note that this solution assumes that you have set up the SQS queue driver correctly in your Laravel app and that you have the necessary AWS credentials and permissions to push messages to the queue.