Author: XE Developers (developers@xpressengine.com)
 /**
  * get dynamic field config list
  *
  * @param ConfigEntity $config board config entity
  * @return array
  */
 public function getDynamicFields(ConfigEntity $config)
 {
     $configs = $this->dynamicField->gets($config->get('documentGroup'));
     if (count($configs) == 0) {
         return [];
     }
     return $configs;
 }
 /**
  * get dynamic field without skin instance
  *
  * @param string $group config group name
  * @param string $id    field type id
  * @return AbstractType
  */
 public function getType($group, $id)
 {
     $config = $this->configHandler->get($group, $id);
     if ($config == null) {
         return null;
     }
     $type = $this->registerHandler->getType($this, $config->get('typeId'));
     $type->setConfig($config);
     return $type;
 }
 /**
  * test orders
  *
  * @return void
  */
 public function testOrders()
 {
     $handler = $this->handler;
     $proxy = m::mock('Xpressengine\\DynamicField\\DatabaseProxy', [$handler])->shouldAllowMockingProtectedMethods()->makePartial();
     $config = $this->getConfigEntity();
     $config->shouldReceive('get')->with('typeId')->andReturn('id');
     $config->shouldReceive('get')->with('use')->andReturn(true);
     $query = m::mock('Illuminate\\Database\\Query\\Builder');
     $type = m::mock('Type', 'Xpressengine\\DynamicField\\AbstractType');
     $type->shouldReceive('setConfig');
     $type->shouldReceive('orders')->andReturn($query);
     $this->configHandler->shouldReceive('gets')->andReturn([$config]);
     $this->registerHandler->shouldReceive('getType')->andReturn($type);
     $result = $proxy->orders($query, []);
     $this->assertInstanceOf('Illuminate\\Database\\Query\\Builder', $result);
 }
 /**
  * test get values
  *
  * @return void
  */
 public function testGetValues()
 {
     $conn = m::mock('Xpressengine\\Database\\VirtualConnectionInterface');
     $conn->shouldReceive('getTablePrefix')->andReturn('prefix');
     $configManager = m::mock('Xpressengine\\Config\\ConfigManager');
     $configManager->shouldReceive('add');
     $handler = new ConfigHandler($conn, $configManager);
     $handler->setTablePrefix('prefix');
     $config = m::mock('Xpressengine\\Config\\ConfigEntity');
     $config->shouldReceive('get')->with('group')->andReturn('group');
     $config->shouldReceive('get')->with('id')->andReturn('id');
     $config->shouldReceive('get')->with('tableMethod')->andReturn(ConfigHandler::CREATE_TABLE_METHOD);
     $this->assertEquals('prefix_group_id', $handler->getTableName($config));
     $this->assertEquals('prefix_revision_group_id', $handler->getRevisionTableName($config));
     $this->assertTrue($handler->isTableMethodCreate($config));
 }