public function testLoadFromFile() { $a = new Model\StructureDo(); $a->setId('chat_tienda'); $a->loadFromFile(DIR_BASE . '/test/data/structures_demo.json'); $this->assertEquals('chat_tienda', $a->getId()); $this->assertEquals('Chat de tienda online', $a->getName()); $this->assertEquals('mongodb', $a->getStorage()); $field = $a->getFields()->get('foo'); $this->assertEquals('foo', $field->getId()); $this->assertEquals('pretty', $field->getName()); $this->assertEquals('text_simple', $field->getType()); $field = $a->getFields()->get('abierta'); $this->assertEquals('abierta', $field->getId()); $this->assertEquals('Abierta', $field->getName()); $this->assertEquals('boolean', $field->getType()); $this->setExpectedException('\\Acd\\Model\\KeyInvalidException'); $fields = $a->getFields()->get('no_exists'); }
/* Show action block */ $skeletonOu = new View\BaseSkeleton(); $contentOu = new View\ContentAdmin(); switch ($action) { case 'login': $skeletonOu->setBodyClass('login'); $contentOu->setActionType('login'); $contentOu->setLogin(isset($_GET['login']) ? $_GET['login'] : ''); break; case 'new': $bResult = isset($_GET['r']) && $_GET['r'] === 'ko' ? false : true; $estructura = new Model\StructureDo(); $skeletonOu->setBodyClass('new'); $contentOu->setActionType('new'); $contentOu->setStorageTypes(conf::$STORAGE_TYPES); $contentOu->setStorage($estructura->getStorage()); $headerMenuOu = new View\HeaderMenu(); $headerMenuOu->setType('back'); $skeletonOu->setHeadTitle('New structure'); $skeletonOu->setHeaderMenu($headerMenuOu->render()); break; case 'edit': try { $id = $_GET['id']; $estructura = $structures->get($id); $contentOu->setStructureId($id); $skeletonOu->setBodyClass('edit'); $contentOu->setActionType('edit'); $contentOu->setStructureName($estructura->getName()); $contentOu->setStorageTypes(conf::$STORAGE_TYPES); $contentOu->setStorage($estructura->getStorage());