Exemplo n.º 1
0
<?php

// Most idiotic cept ever
// Checks that every page has correct translation and correct access control
// That means that it has to be updated nearly on every sneeze
use Codeception\Util\Fixtures;
/** @type \Codeception\Scenario $scenario */
$scenario->groups('front');
\Yii::app()->fixtureManager->prepare();
$I = new TestGuy($scenario);
$I->am('A superpedantic person');
$I->wantTo('Find translation error or improper "back to" link');
$I->expectTo('Fail in my quest');
$languages = array('en', 'ru');
$basePath = \Yii::getPathOfAlias('application.tests._data.pageData');
$privatePages = (require $basePath . '/pages-auth.php');
$publicPages = (require $basePath . '/pages-public.php');
$I->amOnPage(\LoginPage::$url);
$I->submitForm(\LoginPage::$formSelector, array(\LoginPage::$loginField => Fixtures::get('data:users[0]:login'), \LoginPage::$passwordField => Fixtures::get('data:users[0]:password')));
foreach ($languages as $language) {
    \Yii::app()->language = $language;
    $I->setCookie('language', $language);
    $path = $basePath . '/language-' . $language . '.php';
    $data = (require $path);
    foreach ($data as $url => $details) {
        $I->amOnPage($url);
        if (isset($details['title'])) {
            $I->seeInTitle($details['title']);
        }
        if (isset($details['nav'])) {
            foreach ($details['nav'] as $navItem) {
Exemplo n.º 2
0
<?php

use Codeception\Util\Fixtures;
/** @type \Codeception\Scenario $scenario */
$scenario->groups('internals', 'content', 'update');
\Yii::app()->fixtureManager->prepare();
$I = new TestGuy($scenario);
$I->am('Dr. Jan Itor');
$I->wantTo('Update my nickname and see fancy cascade of nickname update in ' . 'previous comments');
$login = Fixtures::get('data:users[0]:login');
$password = Fixtures::get('data:users[0]:password');
$I->amOnPage(\LoginPage::$url);
$I->submitForm(\LoginPage::$formSelector, array(\LoginPage::$loginField => $login, \LoginPage::$passwordField => $password));
$I->amOnPage(\BlogFeedPage::$url);
$I->click(\BlogFeedPage::$postTitleSelector);
$url = $I->grabFromCurrentUrl();
$I->submitForm(\PostPage::$commentForm, array(\PostPage::$commentTextArea => 'sample comment'));
$newUsername = md5(microtime());
$I->amOnPage(\ProfilePage::$url);
$I->submitForm(\ProfilePage::$usernameUpdateFormSelector, array(\ProfilePage::$usernameField => $newUsername));
$I->see('profile.usernameUpdate.success');
$I->amOnPage($url);
$I->seeLink('@' . $newUsername);
\Yii::app()->fixtureManager->prepare();