예제 #1
0
 public function setUp()
 {
     $dao = new \VdmDao();
     $app = new \App();
     $this->myApp = $app->instantiate($dao);
     // we should create a integration database for test
     // because we have to truncate the base to test
     $this->connexion = new \SqliteConnexion();
     $this->connexion->load();
     \Post::truncate();
     for ($i = 1; $i <= 9; $i++) {
         $newPost = new \Post(array('id' => $i, 'content' => 'My content.', 'date' => DateTime::createFromFormat('Y-m-d H:i:s', '2014-0' . $i . '-01 00:00:00'), 'author' => 'TU_' . $i));
         $newPost->save();
     }
     // same author
     $newPost = new \Post(array('id' => $i, 'content' => 'Ceci est un test PHP Back-End.', 'date' => DateTime::createFromFormat('Y-m-d H:i:s', '2015-01-01 00:00:00'), 'author' => 'TU_' . --$i));
     $newPost->save();
 }