public function run(DataContainerInterface $applicationData) { $dao = new ArticleDaoFileSystem('blog/content/'); $list = new ArticleList(); $dao->loadAll($list); $hash = $applicationData->get('request')->get('article'); $applicationData->get('vars')->set('article', $list->getByHash($hash)); }
public function testDaoLoadValidArticles() { $dao = new ArticleDaoFileSystem('tests-articles'); $list = new ArticleList(); $dao->loadAll($list); $this->assertEquals(2, $list->size()); $this->assertArticle($list->getByHash("ceci-est-un-titre"), "ceci-est-un-titre", "Ceci est un titre", "jeanlouisgalere", new DateTime("2011-01-02"), "<h1>Art 1 Contenu du body</h1><p>Contenu du body</p>"); $this->assertArticle($list->getByHash("mon-super-article"), "mon-super-article", "Mon super article", "robert smith de the cure", new DateTime("2010-12-12"), "<h1>Art 3 Contenu</h1><p>Contenu</p><p>Contenu</p><p>Contenu</p><p>Contenu</p>"); }