Beispiel #1
0
 /**
  * @param AcceptanceTester $I
  */
 public function testComment(AcceptanceTester $I)
 {
     $I->wantTo('ensure that post comment works');
     $postView = PostViewPage::openBy($I);
     // $I->see('Sample Post', 'h1');
     $I->see('Sample Post');
     $I->amGoingTo('submit post comment form with no data');
     $postView->submitComment([]);
     $I->expectTo('see validations error');
     $I->see('Name cannot be blank.', '.help-block');
     $I->see('Email cannot be blank.', '.help-block');
     $I->see('Content cannot be blank.', '.help-block');
     $I->amGoingTo('submit post comment form with no correct email');
     $postView->submitComment(['comment_author' => 'tester', 'comment_author_email' => 'tester.email', 'comment_content' => 'New comment']);
     $I->expectTo('see that email is not correct');
     $I->see('Email is not a valid email address.');
     $I->dontSee('Name cannot be blank.', '.help-block');
     $I->dontSee('Content cannot be blank.', '.help-block');
     $I->amGoingTo('submit post comment form with correct data');
     $postView->submitComment(['comment_author' => 'tester', 'comment_author_email' => '*****@*****.**', 'comment_content' => 'New comment']);
     $I->expect('new comment saved');
     $I->dontSee('Name cannot be blank.', '.help-block');
     $I->dontSee('Email cannot be blank.', '.help-block');
     $I->dontSee('Content cannot be blank.', '.help-block');
     PostComment::deleteAll(['comment_author' => 'tester']);
     Post::findOne(1)->updateAttributes(['post_comment_count' => '1']);
 }
Beispiel #2
0
 /**
  * @param FunctionalTester $I
  */
 public function testProtected(FunctionalTester $I)
 {
     Post::findOne(1)->updateAttributes(['password' => 'postpassword']);
     $I->wantTo('ensure that protected post works');
     $postView = PostViewPage::openBy($I);
     $I->see('Sample Post', 'h1');
     $I->amGoingTo('submit password form with incorrect password');
     $postView->submitPassword('wrong_password');
     $I->expectTo('not see the post');
     $I->dontSeeElement('.entry-meta');
     $I->amGoingTo('submit password form with correct password');
     $postView->submitPassword('postpassword');
     $I->expectTo('see the post');
     $I->seeElement('.entry-meta');
     Post::findOne(1)->updateAttributes(['password' => '']);
 }