public function testSearchById() { $folder = FolderQuery::create()->findOne(); if (null === $folder) { $folder = new \Thelia\Model\Folder(); $folder->setParent(0); $folder->setVisible(1); $folder->setTitle('foo'); $folder->save(); } $otherParameters = array("visible" => "*"); $this->baseTestSearchById($folder->getId(), $otherParameters); }
/** * generates a folder and its sub folders to be used in Position tests * * @return int the parent folder id */ protected function getFolderIdForPositionTest() { if (null === self::$folderIdForPositionTest) { $folder = new \Thelia\Model\Folder(); $folder->setParent(0); $folder->setVisible(1); $folder->setPosition(1); $this->setI18n($folder); $folder->save(); for ($i = 0; $i < 4; $i++) { $subFolder = new \Thelia\Model\Folder(); $subFolder->setParent($folder->getId()); $subFolder->setVisible(1); $subFolder->setPosition($i + 1); $this->setI18n($subFolder); $subFolder->save(); } self::$folderIdForPositionTest = $folder->getId(); } return self::$folderIdForPositionTest; }
for ($i = 0; $i < 4; $i++) { $folder = new Thelia\Model\Folder(); $folder->setParent(0); $folder->setVisible(1); $folder->setPosition($i + 1); setI18n($folder); $folder->save(); $image = new \Thelia\Model\FolderImage(); $image->setFolderId($folder->getId()); generate_image($image, 'folder', $folder->getId()); $document = new \Thelia\Model\FolderDocument(); $document->setFolderId($folder->getId()); generate_document($document, 'folder', $folder->getId()); for ($j = 0; $j < 3; $j++) { $subfolder = new Thelia\Model\Folder(); $subfolder->setParent($folder->getId()); $subfolder->setVisible(1); $subfolder->setPosition($j + 1); setI18n($subfolder); $subfolder->save(); $image = new \Thelia\Model\FolderImage(); $image->setFolderId($subfolder->getId()); generate_image($image, 'folder', $subfolder->getId()); $document = new \Thelia\Model\FolderDocument(); $document->setFolderId($folder->getId()); generate_document($document, 'folder', $subfolder->getId()); for ($k = 0; $k < 4; $k++) { $content = new Thelia\Model\Content(); $content->addFolder($subfolder); $contentFolders = $content->getContentFolders(); $collection = new \Propel\Runtime\Collection\Collection();