assert icon indicating copy to clipboard operation
assert copied to clipboard

[POC] Add `Expectation::isJson()` to verify json string and decode

Open kbond opened this issue 3 years ago • 1 comments

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)
;

kbond avatar Jul 11 '22 18:07 kbond

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).

kbond avatar Jul 11 '22 18:07 kbond