/** * @group DataModel * @group DataModelToJson * @covers FOF30\Model\DataModel::toJson * @dataProvider DataModelGenericDataprovider::getTestToJson */ public function testToJson($test) { $config = array('idFieldName' => 'foftest_bare_id', 'tableName' => '#__foftest_bares'); $model = new DataModelStub(static::$container, $config); $model->find(1); $result = $model->toJSon($test['pretty']); $check = array('foftest_bare_id' => '1', 'title' => 'First Row'); if (defined('JSON_PRETTY_PRINT')) { $options = $test['pretty'] ? JSON_PRETTY_PRINT : 0; } else { $options = 0; } $check = json_encode($check, $options); $this->assertEquals($check, $result, 'DataModel::toJson Failed to return the correct result'); }