/** * create default dynamic field * * @param ConfigEntity $boardConfig board config entity * @deprecated */ protected function createDefaultDynamicField(ConfigEntity $boardConfig) { $category = Category::create(['name' => 'board-default']); $config = new ConfigEntity(); foreach (['group' => $boardConfig->get('documentGroup'), 'revision' => $boardConfig->get('revision'), 'id' => 'category', 'typeId' => 'FieldType/xpressengine@Category', 'label' => 'board::category', 'skinId' => 'FieldType/xpressengine@Category/FieldSkin/xpressengine@default', 'use' => true, 'searchable' => true, 'required' => true, 'sortable' => false, 'tableMethod' => false, 'categoryId' => $category->id, 'colorSet' => 'default', 'joinColumnName' => 'id'] as $key => $value) { $config->set($key, $value); } $this->dynamicField->create($config); }
/** * test create invalid config * * @expectedException \Xpressengine\DynamicField\Exceptions\AlreadyExistException * @return void */ public function testCreateAlreadyExist() { $conn = $this->conn; $configHandler = $this->configHandler; $registerHandler = $this->registerHandler; $view = $this->view; $handler = new DynamicFieldHandler($conn, $configHandler, $registerHandler, $view); $config = $this->getConfigEntity(); $config->shouldReceive('get')->with('id')->andReturn('id'); $config->shouldReceive('get')->with('typeId')->andReturn('type'); $config->shouldReceive('get')->with('group')->andReturn('group-name'); $configHandler->shouldReceive('get')->andReturn(1); $handler->create($config); }