public function testJson($string) { if (is_scalar($string) || is_callable([$string, '__toString'])) { json_decode((string) $string, true); return json_last_error() === JSON_ERROR_NONE; } return false; }
public function testTestJsonInvalid() { $app = $this->getApp(); $handler = new TextHandler($app); $result = $handler->testJson('koala'); $this->assertFalse($result); }