Open bbatsche opened 2 years ago
Use __get()
to allow more detailed assertions about individual array elements (if they're assoc)
Also add fileContent()
for strings
Saving this off for 4.0.0
since complex inspectors like this are really going to benefit from multiple levels of chaining
With 4.0.0
we're trying to support deeper inspection of subject through property chaining, but that could interfere with inspecting JSON/array content. Something wild like subject has a user
prop, toJson()
method, and we want to inspect its structure
JSON & Array content inspectors accept an optional callback that allows multiple assertions on content. Something like:
verify($subject)->user->toJson()
->jsonContent(static function (Verifier $jsonConent): void {
$jsonContent->first_name->is()->identicalTo('John')
->and()->last_name->is()->identicalTo('Smith');
});
Verifier to add assertions about the contents of an array or JSON string. Something like: