Exemple #1
0
$I->submitCommentForm('tralalal');
$I->seeCurrentUrlMatches('~^' . $currentUrl . '~');
\PostPage::of($I)->hasErrors();
$I->submitCommentForm('Hey, look at my local email address!', 'marabou', 'marabou@localhost');
$I->seeCurrentUrlMatches('~^' . $currentUrl . '~');
\PostPage::of($I)->hasErrors();
// checking form saving
$I->seeInField(\PostPage::$commentTextArea, 'Hey, look at my local email address!');
$I->seeInField(\PostPage::$commentUsernameField, 'marabou');
$I->seeInField(\PostPage::$commentEmailField, 'marabou@localhost');
$I->submitCommentForm('This is first correct comment', 'marabou', '');
$I->seeCurrentUrlMatches('~^' . $currentUrl . '~');
\PostPage::of($I)->hasNoErrors();
$I->see('This is first correct comment');
$I->submitCommentForm('Second correct comment, now using gravatar', 'marabou', '*****@*****.**');
$I->seeCurrentUrlMatches('~^' . $currentUrl . '~');
\PostPage::of($I)->hasNoErrors();
$I->see('Second correct comment, now using gravatar');
$I->autoLogin();
$username = '******' . $I->username;
$I->amOnPage(\BlogFeedPage::$url);
$I->click(\BlogFeedPage::$postTitleSelector);
$I->seeInField(\PostPage::$commentUsernameField, $username);
$currentUrl = $I->grabFromCurrentUrl('~(.*)~');
$I->submitCommentForm();
$I->seeCurrentUrlMatches('~^' . $currentUrl . '~');
\PostPage::of($I)->hasErrors();
$I->submitCommentForm('test comment');
$I->see('comment.submit.success');
$I->see($username, \PostPage::$commentSelector);
$I->see('timeInterval.justNow', \PostPage::$commentSelector);
Exemple #2
0
 private static function PCSameAuthor($data)
 {
     if (isset(self::$currentObject) && !is_null(self::$currentObject) && self::$currentObject !== false) {
         require_once 'user/UserManager.php';
         $user = UserManager::loadUser(self::$currentObject->getAuthor(), false);
         if (true) {
             //TODO se l'autore vuole
             echo "<p>Dello stesso autore</p>";
             require_once 'search/SearchManager.php';
             $posts = SearchManager::searchBy("Post", array("author" => $user->getID(), "no_id" => self::$currentObject->getID(), "loadComments" => false), array("order" => -1, "by" => "ps_creationDate"));
             self::$post_options[PostPage::SHORT] = true;
             self::$post_options[PostPage::NO_COMMENTS] = true;
             self::$post_options[PostPage::NO_MODIF_DATE] = true;
             require_once 'post/PostPage.php';
             foreach ($posts as $p) {
                 PostPage::showPost($p, self::$post_options);
             }
             self::$post_options[PostPage::SHORT] = false;
             self::$post_options[PostPage::NO_COMMENTS] = false;
             self::$post_options[PostPage::NO_MODIF_DATE] = false;
         }
     }
 }
$I->writePost('', '');
$I->seeCurrentUrlEquals(\PostFormPage::$newPostUrl);
\PostFormPage::of($I)->hasErrors();
$I->writePost('What a title', '');
$I->seeCurrentUrlEquals(\PostFormPage::$newPostUrl);
\PostFormPage::of($I)->hasErrors();
$I->writePost('What a title', 'whatapost');
$I->seeCurrentUrlEquals(\PostFormPage::$newPostUrl);
\PostFormPage::of($I)->hasErrors();
$I->writePost('', 'whatapostapost');
$I->seeCurrentUrlEquals(\PostFormPage::$newPostUrl);
\PostFormPage::of($I)->hasErrors();
$I->writePost('What a title', '*whatapostapost*');
$I->dontSeeInCurrentUrl(\PostFormPage::$newPostUrl);
\PostFormPage::of($I)->hasNoErrors();
$I->seeCurrentUrlEquals(\PostPage::route('what-a-title'));
$I->see('whatapostapost', 'article em');
$I->seeInTitle('What a title');
$I->seeLink('link.edit');
$I->click('link.edit');
$id = $I->grabFromCurrentUrl('~(\\d+)~');
$I->amOnPage(\BlogFeedPage::$url);
$I->see('What a title', '.sidebar');
$I->editPost($id, '');
\PostFormPage::of($I)->hasErrors();
$I->editPost($id, 'Another title', '');
\PostFormPage::of($I)->hasErrors();
$I->editPost($id, 'Another title');
\PostFormPage::of($I)->hasNoErrors();
$I->amOnPage(\BlogFeedPage::$url);
$I->see('Another title', '.sidebar');
Exemple #4
0
// categories
$I->amOnPage(\BlogFeedPage::$url);
$category = \BlogFeedPage::of($I)->getSidebarCategoryTitle(1);
$otherCategory = \BlogFeedPage::of($I)->getSidebarCategoryTitle(2);
$I->click($category, '.sidebar');
$I->seeCurrentUrlMatches(\CategoryFeedPage::$urlRegexp);
$I->seeInTitle($category);
$I->see($category, \CategoryFeedPage::$pageHeaderSelector);
$I->see($category, \CategoryFeedPage::$postCategoryLinkSelector);
$I->dontSee($otherCategory, 'article');
/*
$I->amOnPage(\CategoryFeedPage::route('category-1', 2));
$I->see('heading.httpError [errorCode:404]');
$I->dontSeeElement('article');
*/
// authors
$I->amOnPage(\BlogFeedPage::$url);
$firstPostTitle = $I->grabTextFrom(\BlogFeedPage::$postTitleSelector);
$authorName = $I->grabTextFrom(\BlogFeedPage::$postUserLinkSelector);
$I->click(\AuthorFeedPage::$postUserLinkSelector, 'article');
$I->seeCurrentUrlMatches(\AuthorFeedPage::$urlRegexp);
$I->seeInTitle($authorName);
$I->seeInTitle('pageTitle.user.index');
$I->see($authorName, \AuthorFeedPage::$pageHeaderSelector);
$I->see($firstPostTitle, 'article');
$I->click($firstPostTitle);
$I->seeInTitle($firstPostTitle);
$I->see($firstPostTitle, \PostPage::$postTitleSelector);
$I->amOnPage(\PostPage::route('slug-that-doesnt-exist-in-fixtures'));
$I->seeHttpErrorPage(404);
$I->dontSeeElement('article');