Example #1
0
 protected function loadArticles($nb)
 {
     $articles = array();
     for ($i = 1; $i <= $nb; $i++) {
         $article = new Article();
         $article->setTitle($i);
         $this->molino->save($article);
         $articles[] = $article;
     }
     return $articles;
 }
Example #2
0
 public function testDelete()
 {
     $article = new Article();
     $article->setTitle('foo');
     $this->molino->save($article);
     $id = $article->getId();
     $this->molino->delete($article);
     $rp = new \ReflectionProperty($this->molino, 'data');
     $rp->setAccessible(true);
     $data = $rp->getValue($this->molino);
     $this->assertArrayNotHasKey($id, $data['Model\\Memory\\Article']);
 }
Example #3
0
 protected function loadTestArticles()
 {
     $articles = array(array('title' => 'foo', 'author' => 'Smith', 'pages' => 10), array('title' => 'bar', 'author' => 'Jones', 'pages' => 15), array('title' => 'tofoo', 'author' => 'Johnson', 'pages' => 20), array('title' => 'foos', 'author' => 'Williams', 'pages' => 25), array('title' => 'freefood', 'author' => 'Brown', 'pages' => 30), array('title' => 'froo', 'author' => 'Davis', 'pages' => 35));
     foreach ($articles as $data) {
         $author = new User();
         $author->setName($data['author']);
         $article = new Article();
         $article->setAuthor($author)->setPages($data['pages'])->setTitle($data['title']);
         $this->molino->save($article);
     }
 }