Пример #1
0
 /**
  * @param FunctionalTester $I
  */
 public function testProtected(FunctionalTester $I)
 {
     Media::findOne(1)->updateAttributes(['password' => 'mediapassword']);
     $I->wantTo('ensure that protected media works');
     $mediaView = MediaViewPage::openBy($I);
     $I->see('Test Media', 'h1');
     $I->amGoingTo('submit password form with incorrect password');
     $mediaView->submitPassword('wrong_password');
     $I->expectTo('not see the media');
     $I->dontSeeElement('.entry-meta');
     $I->amGoingTo('submit password form with correct password');
     $mediaView->submitPassword('mediapassword');
     $I->expectTo('see the post');
     $I->seeElement('.entry-meta');
     $I->seeLink('Test Media');
     Media::findOne(1)->updateAttributes(['password' => '']);
 }
Пример #2
0
 /**
  * @param AcceptanceTester $I
  */
 public function testComment(AcceptanceTester $I)
 {
     $I->wantTo('ensure that media comment works');
     $mediaView = MediaViewPage::openBy($I);
     // $I->see('Test Media', 'h1');
     $I->see('Test Media');
     $I->amGoingTo('submit media comment form with no data');
     $mediaView->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 media comment form with no correct email');
     $mediaView->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 media comment form with correct data');
     $mediaView->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');
     MediaComment::deleteAll(['comment_author' => 'tester']);
     Media::findOne(1)->updateAttributes(['media_comment_count' => '1']);
 }