/**
  * @test
  */
 public function category_create_and_find_it_in_database()
 {
     $request = new Http("/article/addcategory");
     $request->setQuery('name', 'news');
     $this->getApplication()->getDispatcher()->dispatch($request);
     $category_name = '';
     $this->getDatabase()->query_and_fetch("SELECT * FROM category WHERE name = 'news';", function ($row) use(&$category_name) {
         $category_name = $row['name'];
     });
     $this->assertEquals('news', $category_name);
 }
 /**
  * @test
  */
 public function comment_create_and_find_it_in_database()
 {
     $this->setUpArticle();
     $request = new Http("/article/addcomment");
     $request->setQuery('article_id', '1');
     $request->setQuery('content', 'r');
     $this->getApplication()->getDispatcher()->dispatch($request);
     $comment = null;
     $this->getDatabase()->query_and_fetch("SELECT * FROM comment WHERE id = 1;", function ($row) use(&$comment) {
         $comment = $row;
     });
     $this->assertEquals('1', $comment['article_id']);
     $this->assertEquals('r', $comment['content']);
 }
Esempio n. 3
0
 /**
  * @test
  */
 public function category_create_and_find_it_in_database()
 {
     $this->setUpCategory();
     $request = new Http("/article/add");
     $request->setQuery('category_id', '1');
     $request->setQuery('subject', 's');
     $request->setQuery('content', 'c');
     $this->getApplication()->getDispatcher()->dispatch($request);
     $article = null;
     $this->getDatabase()->query_and_fetch("SELECT * FROM article WHERE id = 1;", function ($row) use(&$article) {
         $article = $row;
     });
     $this->assertEquals('1', $article['category_id']);
     $this->assertEquals('s', $article['subject']);
     $this->assertEquals('c', $article['content']);
 }