Ejemplo n.º 1
0
<?php

/** @type \Codeception\Scenario $scenario */
$scenario->groups('front', 'posts', 'cache');
$I = new WebGuy\MemberSteps($scenario);
$I->am('Web developer');
$I->wantTo('Test cache system by writing post and tweaking service settings');
$I->expectTo('See changes instantly');
$I->autoLogin();
// if any other category is modified but the top one, categories may change
// positions in sidebar, and this behavior would be much harder to test.
$categoryNumber = 0;
$I->flushCache();
$stats = \ServiceStatusPage::of($I)->grabStats();
$totalPostsNumber = $stats['totalPosts'];
$postsTodayNumber = $stats['postsToday'];
$commentsTodayNumber = $stats['commentsToday'];
$totalCommentsNumber = $stats['totalComments'];
$I->amOnPage(\BlogFeedPage::$url);
$categoryTitle = \BlogFeedPage::of($I)->grabCategoryTitle($categoryNumber);
$categoryPostCount = \BlogFeedPage::of($I)->grabCategoryPostCount($categoryNumber);
$posts = array();
// there were issues with stall cache after series of fast posts, so this
// construct verifies that it doesn't happen again
for ($i = 0; $i < 5; $i++) {
    $title = md5(time()) . $i;
    $I->amOnPage(\BlogFeedPage::$url);
    $I->dontSee($title);
    $I->writePost($title, 'superpost is superposted', null, $categoryTitle);
    $elemId = $I->grabAttributeFrom(\PostPage::$postSelector, 'id');
    preg_match('#\\d+#', $elemId, $matches);