/** * @expectedException Exception */ public function testSetConfigException() { $cfg = new Config(['apiEndpoint' => 'rest-url', 'primaryKey' => 'id']); $cfg->setConfig(['foo' => 'bar']); $cfg->setConfig(['not' => 'valid']); // will throw exception: Cant set config if config is not empty }
public function testNgRestConfigAppendFieldOption() { $configData = $this->getConfig(); $ngRest = new Config(['apiEndpoint' => 'api-admin-test', 'primaryKey' => 'id']); $ngRest->setConfig($configData); $ngRest->appendFieldOption('list_var_1', 'i18n', true); $field = $ngRest->getField('list', 'list_var_1'); $this->assertEquals(true, $field['i18n']); $field = $ngRest->getField('list', 'list_var_2'); $this->assertEquals(false, $field['i18n']); }