/** * config entity list 반환 * * @param string $group group name * @return array */ public function gets($group) { $config = $this->parent($group); if ($config === null) { return []; } return $this->configManager->children($config); }
/** * get all board configs * * @return array */ public function gets() { $parent = $this->configManager->get(self::CONFIG_NAME); if ($parent === null) { return []; } $configs = $this->configManager->children($parent); return $configs; }
public function testChildrenReturnsAdjacencyConfigs() { list($repo, $validator) = $this->getMocks(); $mockConfig = m::mock('Xpressengine\\Config\\ConfigEntity'); $mockConfig->siteKey = 'default'; $mockConfig->name = 'board.notice'; $mockConfig->shouldReceive('getDepth')->andReturn(2); $mockBD1 = m::mock('Xpressengine\\Config\\ConfigEntity'); $mockBD1->name = 'board.notice.bd1'; $mockBD1->shouldReceive('getDepth')->andReturn(3); $mockBD2 = m::mock('Xpressengine\\Config\\ConfigEntity'); $mockBD2->name = 'board.notice.bd2'; $mockBD2->shouldReceive('getDepth')->andReturn(3); $mockBD3 = m::mock('Xpressengine\\Config\\ConfigEntity'); $mockBD3->name = 'board.notice.bd1.sub1'; $mockBD3->shouldReceive('getDepth')->andReturn(4); $repo->shouldReceive('fetchChildren')->once()->with('default', 'board.notice')->andReturn([$mockBD1, $mockBD2, $mockBD3]); $repo->shouldReceive('fetchParent')->andReturn([]); $instance = new ConfigManager($repo, $validator); $children = $instance->children($mockConfig); $this->assertEquals(2, count($children)); $this->assertEquals('board.notice.bd1', $children[0]->name); $this->assertEquals('board.notice.bd2', $children[1]->name); }
/** * config entity list 반환 * list of ConfigEntity * * @return array */ public function gets() { return $this->configManager->children($this->get()); }