public function testConfigure() { list($member, $auth, $repo, $cfg) = $this->getMocks(); $instance = new CommentHandler($member, $auth, $repo, $cfg); $information = ['division' => true, 'useApprove' => false, 'secret' => true]; $mockConfig = m::mock('Xpressengine\\Config\\ConfigEntity'); $mockConfig->shouldReceive('set')->once()->with('useAssent', false); $mockConfig->shouldReceive('set')->once()->with('useDissent', false); $mockConfig->shouldReceive('set')->once()->with('useApprove', false); $mockConfig->shouldReceive('set')->once()->with('secret', true); $mockConfig->shouldReceive('set')->once()->with('perPage', 20); $mockConfig->shouldReceive('set')->once()->with('useWysiwyg', false); $mockConfig->shouldReceive('set')->once()->with('removeType', 'batch'); $mockConfig->shouldReceive('set')->once()->with('reverse', false); $cfg->shouldReceive('get')->once()->with('comments.instanceId')->andReturn($mockConfig); $cfg->shouldReceive('modify')->once()->with($mockConfig)->andReturnNull(); $instance->configure('instanceId', $information); }
/** * 게시판 생성 * * @param array $params parameters * @return ConfigEntity */ public function create(array $params) { if (empty($params['boardId']) === true) { throw new RequiredValueException(); } $config = $this->configHandler->get($params['boardId']); if ($config !== null) { throw new AlreadyExistsInstanceException(); } $this->conn->beginTransaction(); $documentConfig = $this->document->createInstance($params['boardId'], $params); // create comment config(create new comment instance) $this->comment->createInstance($documentConfig->get('instanceId'), $documentConfig->get('division')); $this->comment->configure($documentConfig->get('instanceId'), ['useWysiwyg' => true]); $params['documentGroup'] = $documentConfig->get('group'); $params['commentGroup'] = 'comments_' . $documentConfig->get('instanceId'); $config = $this->configHandler->add($params); // category dynamic field create //$this->createDefaultDynamicField($config); $this->conn->commit(); return $config; }