<commit_before><?php
namespace app\tests\functional;

use Yii;
use app\tests\FunctionalTester;
use common\tests\fixtures\UserFixture;
use common\tests\fixtures\UserSettingFixture;
use common\models\User;

/**
 * SiteController functional tests.
 *
 * @author <NAME> <<EMAIL>>
 */
class SiteCest
{
    /**
     * @inheritdoc
     */
    public function _before(FunctionalTester $I)
    {
        $I->haveFixtures([
            'user' => [
                'class'    => UserFixture::className(),
                'dataFile' => Yii::getAlias('@common/tests/_data/user.php'),
            ],
            'setting' => [
                'class'    => UserSettingFixture::className(),
                'dataFile' => Yii::getAlias('@common/tests/_data/user_setting.php'),
            ],
        ]);
    }

/* Index/Dashboard home action:
------------------------------------------------------------------- */
    /**
     * @param FunctionalTester $I
     */
    public function dashboard(FunctionalTester $I)
    {
        $I->wantTo('Check if the dashboard is rendered correctly');
        $I->amLoggedInAs(1004);
        $I->amOnPage(['site/index']);
        $I->seeResponseCodeIs(200);
        $I->seeCurrentUrlEquals(['site/index']);
        $I->see('Dashboard');
    }

/* Logout action:
------------------------------------------------------------------- */
    /**
     * @param FunctionalTester $I
     */
    public function logout(FunctionalTester $I)
    {
        $I->wantTo('Logout a logged in user');
        $I->amLoggedInAs(1002);
        $I->amOnPage(['site/index']);
        $I->seeResponseCodeIs(200);
        $I->sendPOST(['site/logout']);
        $I->seeResponseCodeIs(200);
        $I->seeCurrentUrlEquals(['site/entrance']);
        $I->seeFlash('info');
    }

/* Entrance action:
------------------------------------------------------------------- */
    /**
     * @param FunctionalTester $I
     */
    public function entranceGeneral(FunctionalTester $I)
    {
        $I->wantTo('Check entrance tabs and links');
        $I->amOnPage(['site/entrance']);
        $I->seeResponseCodeIs(200);

        $I->expectTo('see entrance tabs');
        $I->seeElement('.tabs-header .tab-item[data-target="#login"]');
        $I->seeElement('.tabs-header .tab-item[data-target="#register"]');
        $I->seeElement('.tabs-content .tab-item#login');
        $I->seeElement('.tabs-content .tab-item#register');

        $I->expectTo('see register form elements');
        $I->seeElement('[name="RegisterForm[email]"]');
        $I->seeElement('[name="RegisterForm[password]"]');
        $I->seeElement('[name="RegisterForm[terms]"]');

        $I->expectTo('see login form elements');
        $I->seeElement('[name="LoginForm[email]"]');
        $I->seeElement('[name="LoginForm[password]"]');
        $I->seeElement('a.forgotten-password');
        $I->seeElement('a.facebook-link');
    }

    /**
     * @param FunctionalTester $I
     */
    public function loginFail(FunctionalTester $I)
    {
        $I->wantTo('Fail login');
        $I->amOnPage(['site/entrance']);
        $I->seeResponseCodeIs(200);
        $I->submitForm('#login_form', [
            'LoginForm' => [
                'email'    => 'invalid_email@',
                'password' => '',
            ],
        ]);
        $I->seeElement('.field-loginform-email.has-error');
        $I->seeElement('.field-loginform-password.has-error');
    }

    /**
     * @param FunctionalTester $I
     */
    public function loginSuccess(FunctionalTester $I)
    {<commit_msg>removed social links check from SiteCest<commit_after><?php
namespace app\tests\functional;

use Yii;
use app\tests\FunctionalTester;
use common\tests\fixtures\UserFixture;
use common\tests\fixtures\UserSettingFixture;
use common\models\User;

/**
 * SiteController functional tests.
 *
 * @author <NAME> <<EMAIL>>
 */
class SiteCest
{
    /**
     * @inheritdoc
     */
    public function _before(FunctionalTester $I)
    {
        $I->haveFixtures([
            'user' => [
                'class'    => UserFixture::className(),
                'dataFile' => Yii::getAlias('@common/tests/_data/user.php'),
            ],
            'setting' => [
                'class'    => UserSettingFixture::className(),
                'dataFile' => Yii::getAlias('@common/tests/_data/user_setting.php'),
            ],
        ]);
    }

/* Index/Dashboard home action:
------------------------------------------------------------------- */
    /**
     * @param FunctionalTester $I
     */
    public function dashboard(FunctionalTester $I)
    {
        $I->wantTo('Check if the dashboard is rendered correctly');
        $I->amLoggedInAs(1004);
        $I->amOnPage(['site/index']);
        $I->seeResponseCodeIs(200);
        $I->seeCurrentUrlEquals(['site/index']);
        $I->see('Dashboard');
    }

/* Logout action:
------------------------------------------------------------------- */
    /**
     * @param FunctionalTester $I
     */
    public function logout(FunctionalTester $I)
    {
        $I->wantTo('Logout a logged in user');
        $I->amLoggedInAs(1002);
        $I->amOnPage(['site/index']);
        $I->seeResponseCodeIs(200);
        $I->sendPOST(['site/logout']);
        $I->seeResponseCodeIs(200);
        $I->seeCurrentUrlEquals(['site/entrance']);
        $I->seeFlash('info');
    }

/* Entrance action:
------------------------------------------------------------------- */
    /**
     * @param FunctionalTester $I
     */
    public function entranceGeneral(FunctionalTester $I)
    {
        $I->wantTo('Check entrance tabs and links');
        $I->amOnPage(['site/entrance']);
        $I->seeResponseCodeIs(200);

        $I->expectTo('see entrance tabs');
        $I->seeElement('.tabs-header .tab-item[data-target="#login"]');
        $I->seeElement('.tabs-header .tab-item[data-target="#register"]');
        $I->seeElement('.tabs-content .tab-item#login');
        $I->seeElement('.tabs-content .tab-item#register');

        $I->expectTo('see register form elements');
        $I->seeElement('[name="RegisterForm[email]"]');
        $I->seeElement('[name="RegisterForm[password]"]');
        $I->seeElement('[name="RegisterForm[terms]"]');

        $I->expectTo('see login form elements');
        $I->seeElement('[name="LoginForm[email]"]');
        $I->seeElement('[name="LoginForm[password]"]');
        $I->seeElement('a.forgotten-password');
    }

    /**
     * @param FunctionalTester $I
     */
    public function loginFail(FunctionalTester $I)
    {
        $I->wantTo('Fail login');
        $I->amOnPage(['site/entrance']);
        $I->seeResponseCodeIs(200);
        $I->submitForm('#login_form', [
            'LoginForm' => [
                'email'    => 'invalid_email@',
                'password' => '',
            ],
        ]);
        $I->seeElement('.field-loginform-email.has-error');
        $I->seeElement('.field-loginform-password.has-error');
    }

    /**
     * @param FunctionalTester $I
     */
    public function loginSuccess(FunctionalTester $I)
    {
{'fraction_non_alphanumeric': 0.22900763358778625, 'fraction_numerical': 0.006502685891998869, 'mean_word_length': 1.9751892346509672, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 102, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2342587', 'n_tokens_mistral': 2142, 'n_tokens_neox': 2070, 'n_words': 298}