/** * 게시판 제거 * * @param string $boardId board id * @return void */ public function destroy($boardId) { $config = $this->configHandler->get($boardId); if ($config === null) { throw new Exceptions\InvalidConfigException(); } $this->conn->beginTransaction(); // get document config $this->document->destroyInstance($boardId); $this->comment->drop($boardId); // remove board config $this->configHandler->remove($config); // 연결된 df 제거 foreach ($this->configHandler->getDynamicFields($config) as $config) { $this->dynamicField->drop($config); } $this->conn->commit(); }
/** * test drop * * @return void */ public function testDrop() { $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('typeId')->andReturn('type'); $configHandler->shouldReceive('remove'); $conn->shouldReceive('beginTransaction'); $conn->shouldReceive('commit'); $type = m::mock('Type', 'Xpressengine\\DynamicField\\AbstractType'); $type->shouldReceive('setConfig'); $type->shouldReceive('drop'); $registerHandler->shouldReceive('getType')->andReturn($type); $handler->drop($config); }