コード例 #1
0
 /**
  * @throws SpoonDatabaseException
  */
 public function testInsert()
 {
     $userRecord['username'] = '******';
     $userRecord['email'] = '*****@*****.**';
     $userRecord['developer'] = 'N';
     for ($i = 0; $i < self::NUMBER_OF_ROWS; $i++) {
         $this->db->insert('users', $userRecord);
     }
 }
コード例 #2
0
ファイル: LoadFaqQuestions.php プロジェクト: bwgraves/forkcms
 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));
 }
コード例 #3
0
ファイル: LoadBlogPosts.php プロジェクト: forkcms/forkcms
 /**
  * @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'));
 }
コード例 #5
0
 /**
  * @depends testExecute
  */
 public function testInsert()
 {
     // data
     $aData['username'] = '******';
     $aData['email'] = '*****@*****.**';
     $aData['developer'] = 'N';
     // insert one record
     $this->db->insert('users', $aData);
     // insert 1000 records
     for ($i = 0; $i < 1000; $i++) {
         $array[$i] = $aData;
     }
     $this->db->insert('users', $array);
 }
コード例 #6
0
 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'));
 }
コード例 #7
0
ファイル: LoadFaqCategories.php プロジェクト: forkcms/forkcms
 /**
  * @param \SpoonDatabase $database
  */
 public function load(\SpoonDatabase $database)
 {
     $metaId = $database->insert('meta', array('keywords' => 'Faq for tests', 'description' => 'Faq for tests', 'title' => 'Faq for tests', 'url' => 'faqcategory-for-tests'));
     $database->insert('faq_categories', array('meta_id' => $metaId, 'extra_id' => 0, 'language' => 'en', 'title' => 'Faq for tests', 'sequence' => 1));
 }
コード例 #8
0
 /**
  * @param \SpoonDatabase $database
  */
 public function load(\SpoonDatabase $database)
 {
     $metaId = $database->insert('meta', array('keywords' => 'BlogCategory for tests', 'description' => 'BlogCategory for tests', 'title' => 'BlogCategory for tests', 'url' => 'blogcategory-for-tests'));
     $database->insert('blog_categories', array('meta_id' => $metaId, 'language' => 'en', 'title' => 'BlogCategory for tests'));
 }