assert
assert copied to clipboard
[POC] Add `Expectation::isJson()` to verify json string and decode
Per a slack discussion with @nikophil.
Assert::that('[4, 5, 6]')
->isJson() // json_decode's the current value and starts a new expectation with this
->contains(5)
;
Assert::that('5')
->isJson()
->is(5)
->isGreaterThan(4)
;
Not sure we want to do this but wanted to capture our conversation with a POC. We could go even further and move the Json class from zenstruck/browser here (and have Expectation::isJson(): Json).