Complete Json PostgreSQL tests
This commit is contained in:
@@ -78,20 +78,14 @@ describe('::jsonArray()', function () {
|
||||
|
||||
describe('::outputJsonArray()', function () {
|
||||
test('outputs non-empty array when data found', function () {
|
||||
ob_clean();
|
||||
ob_start();
|
||||
$this->clearBuffer();
|
||||
Custom::outputJsonArray(Query::selectFromTable(ThrowawayDb::TABLE) . " WHERE data->>'sub' IS NOT NULL", []);
|
||||
$json = ob_get_contents();
|
||||
ob_end_clean();
|
||||
expect($json)->toContain('[{', '},{', '}]');
|
||||
expect($this->getBufferContents())->toContain('[{', '},{', '}]');
|
||||
});
|
||||
test('outputs empty array when no data found', function () {
|
||||
ob_clean();
|
||||
ob_start();
|
||||
$this->clearBuffer();
|
||||
Custom::outputJsonArray(Query::selectFromTable(ThrowawayDb::TABLE) . " WHERE data->>'nothing' = '7'", []);
|
||||
$json = ob_get_contents();
|
||||
ob_end_clean();
|
||||
expect($json)->toBe('[]');
|
||||
expect($this->getBufferContents())->toBe('[]');
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user