/**
  * @depends testExecute
  */
 public function testDelete()
 {
     // delete record 1 and 1001
     $this->db->delete('users', 'id = ?', 1);
     $this->db->delete('users', 'id = :id', array(':id' => 1001));
     // 999 records should remain
     $this->assertEquals(999, $this->db->getVar('SELECT COUNT(id) FROM users'));
 }
 public function load(\SpoonDatabase $database)
 {
     $galleryId = $database->getVar('SELECT id
          FROM slideshow_galleries
          WHERE title = :title AND language = :language
          LIMIT 1', array('title' => 'Slideshow for functional tests', 'language' => 'en'));
     $database->insert('slideshow_images', array('id' => 1, 'gallery_id' => $galleryId, 'language' => 'en', 'title' => 'Slideshow image for functional tests', 'caption' => '<p>caption of the slideshow image</p>', 'filename' => 'slideshow-image-for-functional-tests'));
 }
Пример #3
0
 public function load(\SpoonDatabase $database)
 {
     $metaId = $database->insert('meta', array('keywords' => 'Is this a working test?', 'description' => 'Is this a working test?', 'title' => 'Is this a working test?', 'url' => 'is-this-a-working-test'));
     $categoryId = $database->getVar('SELECT id
          FROM faq_categories
          WHERE title = :title AND language = :language
          LIMIT 1', array('title' => 'Faq for tests', 'language' => 'en'));
     $database->insert('faq_questions', array('meta_id' => $metaId, 'category_id' => $categoryId, 'user_id' => 1, 'language' => 'en', 'question' => 'Is this a working test?', 'answer' => '<p>I hope so.</p>', 'created_on' => '2015-02-23 00:00:00', 'hidden' => 'N', 'sequence' => 1));
 }
Пример #4
0
 /**
  * Set the number of results.
  */
 private function setNumResults()
 {
     // based on resultsQuery
     if ($this->numResultsQuery != '') {
         $this->numResults = (int) $this->db->getVar($this->numResultsQuery, $this->numResultsQueryParameters);
     } else {
         $this->numResults = (int) $this->db->getNumRows($this->query, $this->queryParameters);
     }
 }
Пример #5
0
 /**
  * @param \SpoonDatabase $database
  */
 public function load(\SpoonDatabase $database)
 {
     $metaId = $database->insert('meta', array('keywords' => 'Blogpost for functional tests', 'description' => 'Blogpost for functional tests', 'title' => 'Blogpost for functional tests', 'url' => 'blogpost-for-functional-tests'));
     $categoryId = $database->getVar('SELECT id
          FROM blog_categories
          WHERE title = :title AND language = :language
          LIMIT 1', array('title' => 'BlogCategory for tests', 'language' => 'en'));
     $database->insert('blog_posts', array('id' => 1, 'meta_id' => $metaId, 'category_id' => $categoryId, 'user_id' => 1, 'language' => 'en', 'title' => 'Blogpost for functional tests', 'introduction' => '<p>Lorem ipsum dolor sit amet</p>', 'text' => '<p>Lorem ipsum dolor sit amet</p>', 'status' => 'active', 'publish_on' => '2015-02-23 00:00:00', 'created_on' => '2015-02-23 00:00:00', 'edited_on' => '2015-02-23 00:00:00', 'num_comments' => 0));
     $database->insert('search_index', array('module' => 'Blog', 'other_id' => 1, 'field' => 'title', 'value' => 'Blogpost for functional tests', 'language' => 'en', 'active' => 'Y'));
 }
 public function load(\SpoonDatabase $database)
 {
     $metaId = $database->insert('meta', array('keywords' => 'Slideshow for functional tests', 'description' => 'Slideshow for functional tests', 'title' => 'Slideshow for functional tests', 'url' => 'slideshow-for-functional-tests'));
     $categoryId = $database->getVar('SELECT id
          FROM slideshow_categories
          WHERE title = :title AND language = :language
          LIMIT 1', array('title' => 'SlideshowCategory for tests', 'language' => 'en'));
     $database->insert('slideshow_galleries', array('id' => 1, 'meta_id' => $metaId, 'category_id' => $categoryId, 'user_id' => 1, 'language' => 'en', 'title' => 'Slideshow for functional tests', 'description' => '<p>Description of the slideshow</p>', 'width' => 200, 'height' => 200, 'publish_on' => '2015-03-27 00:00:00', 'created_on' => '2015-03-27 00:00:00', 'edited_on' => '2015-03-27 00:00:00'));
     $database->insert('search_index', array('module' => 'Slideshow', 'other_id' => 1, 'field' => 'title', 'value' => 'Slideshow for functional tests', 'language' => 'en', 'active' => 'Y'));
 }