public function testCreateInstance()
 {
     list($member, $auth, $repo, $cfg) = $this->getMocks();
     $instance = new CommentHandler($member, $auth, $repo, $cfg);
     $cfg->shouldReceive('set')->once()->with('comments.instanceId', m::on(function () {
         return true;
     }));
     $repo->shouldReceive('createInstance')->once()->with('instanceId');
     $instance->createInstance('instanceId');
 }
Пример #2
0
 /**
  * 게시판 생성
  *
  * @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;
 }