Exemplo n.º 1
0
 /**
  * @test
  * it should allow having a link in the database
  */
 public function it_should_allow_having_a_link_in_the_database(FunctionalTester $I)
 {
     $now = time();
     Date::_injectNow($now);
     $linkId = $I->haveLinkInDatabase();
     $table = $I->grabLinksTableName();
     $criteria = Links::getDefaults();
     $criteria['link_id'] = $linkId;
     $I->seeInDatabase($table, $criteria);
 }
Exemplo n.º 2
0
 /**
  * @test
  * it should allow overriding a comment defaults
  */
 public function it_should_allow_overriding_a_comment_defaults(FunctionalTester $I)
 {
     $now = time();
     Date::_injectNow($now);
     $postId = $I->havePostInDatabase();
     $overrides = ['comment_author' => 'Luca', 'comment_author_email' => '*****@*****.**', 'comment_author_url' => 'https://theaveragedev.com', 'comment_author_IP' => '111.222.333.444', 'comment_date' => Date::now(), 'comment_date_gmt' => Date::gmtNow(), 'comment_content' => "No comment", 'comment_karma' => '3', 'comment_approved' => '0', 'comment_agent' => 'some agent', 'comment_type' => 'status', 'comment_parent' => 23, 'user_id' => 12];
     $id = $I->haveCommentInDatabase($postId, $overrides);
     foreach ($overrides as $key => $value) {
         $I->seeInDatabase($I->grabCommentsTableName(), ['comment_post_ID' => $postId, 'comment_ID' => $id, $key => $value]);
     }
 }
Exemplo n.º 3
0
 /**
  * @test
  * it should allow overriding defaults when having blogs
  */
 public function it_should_allow_overriding_defaults_when_having_blogs(FunctionalTester $I)
 {
     $now = time() - 3600;
     Date::_injectNow($now);
     $I->haveMultisiteInDatabase();
     $overrides = ['site_id' => 2, 'domain' => 'test1.something.else', 'path' => '/other/folder', 'registered' => date(Date::DATE_FORMAT, $now), 'last_updated' => date(Date::DATE_FORMAT, $now), 'public' => 0, 'archived' => 1, 'mature' => 1, 'spam' => 1, 'deleted' => 1, 'lang_id' => 3];
     $blogId = $I->haveBlogInDatabase('test1', $overrides);
     foreach ($overrides as $key => $value) {
         $I->seeBlogInDatabase(['blog_id' => $blogId, $key => $value]);
     }
 }
Exemplo n.º 4
0
 /**
  * @test
  * it should allow overriding with n key when having many posts
  */
 public function it_should_allow_overriding_with_n_key_when_having_many_posts(FunctionalTester $I)
 {
     $table = $I->grabPostsTableName();
     Date::_injectNow(time() - 300);
     $now = Date::now();
     $gmtNow = Date::gmtNow();
     $overrides = ['post_author' => '{{n}}', 'post_date' => $now, 'post_date_gmt' => $gmtNow, 'post_content' => "Post content {{n}}", 'post_title' => 'Post title {{n}}', 'post_excerpt' => "Post excerpt {{n}}", 'post_status' => 'draft', 'comment_status' => 'closed', 'ping_status' => 'closed', 'post_password' => '{{n}}foo{{n}}', 'post_name' => 'post-title-{{n}}', 'to_ping' => 1, 'pinged' => 1, 'post_modified' => $now, 'post_modified_gmt' => $gmtNow, 'post_content_filtered' => 'Foo bar {{n}}{{n}}', 'post_parent' => 23, 'guid' => 'http://example.com/?p={{n}}&var={{n}}', 'menu_order' => '{{n}}', 'post_type' => 'antother_type'];
     $post_ids = $I->haveManyPostsInDatabase(3, $overrides);
     foreach ($overrides as $key => $value) {
         for ($i = 0; $i < count($post_ids); $i++) {
             $post_id = $post_ids[$i];
             $processedValue = str_replace('{{n}}', $i, $value);
             $I->seeInDatabase($table, ['ID' => $post_id, $key => $processedValue]);
         }
     }
 }