Roni's avatar
Level 33

Add a macro to arrays for test assertions

Hey, just a quick question on array assertions. Does anyone know if I can wrap a test in a method/macro that runs on an array?

Right now, I'm using assertTrue(in_array($needs, $responseArray)), but I'd much rather macro it and add something like $responseArray->assertContains($data) and $responseArray->assertDoesNotContain($data);

Is there a way to accomplish that?

Using laravel 5.7

Thanks

0 likes
1 reply

Please or to participate in this conversation.