'abc'], 201); $this->fail('Expected QdbHttpResponse'); } catch (QdbHttpResponse $e) { $this->assertSame(201, $e->status); $this->assertTrue($e->body['ok']); $this->assertSame(['token' => 'abc'], $e->body['data']); } } public function testJsonErrorEnvelope(): void { try { json_error('INVALID_CREDENTIALS', 'Bad login', 401); $this->fail('Expected QdbHttpResponse'); } catch (QdbHttpResponse $e) { $this->assertSame(401, $e->status); $this->assertFalse($e->body['ok']); $this->assertSame('INVALID_CREDENTIALS', $e->body['error']['code']); $this->assertSame('Bad login', $e->body['error']['message']); } } }