Failed Conditions
Pull Request — experimental/sf (#3434)
by
unknown
237:44 queued 227:26
created

codeception/acceptance/EF06OtherCest.php (1 issue)

Severity

Upgrade to new PHP Analysis Engine

These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more

1
<?php
2
3
use Codeception\Util\Fixtures;
4
5
/**
6
 * @group front
7
 * @group other
8
 * @group ef6
9
 */
10
class EF06OtherCest
11
{
12
    public function _before(\AcceptanceTester $I)
13
    {
14
    }
15
16
    public function _after(\AcceptanceTester $I)
17
    {
18
    }
19
20 View Code Duplication
    public function other_ログイン正常(\AcceptanceTester $I)
21
    {
22
        $I->wantTo('EF0601-UC01-T01 ログイン 正常パターン');
23
        $I->logoutAsMember();
24
25
        $createCustomer = Fixtures::get('createCustomer');
26
        $customer = $createCustomer();
27
        $I->loginAsMember($customer->getEmail(), 'password');
28
    }
29
30 View Code Duplication
    public function other_ログイン異常1(\AcceptanceTester $I)
31
    {
32
        $I->wantTo('EF0601-UC01-T02 ログイン 異常パターン(仮会員)');
33
        $I->logoutAsMember();
34
35
        $createCustomer = Fixtures::get('createCustomer');
36
        $customer = $createCustomer(null, false);
37
38
        $I->amOnPage('/mypage/login');
39
        $I->submitForm('#login_mypage', [
40
            'login_email' => $customer->getEmail(),
41
            'login_pass' => 'password'
42
        ]);
43
44
        $I->see('ログインできませんでした。', 'div.ec-login p.ec-errorMessage');
45
    }
46
47 View Code Duplication
    public function other_ログイン異常2(\AcceptanceTester $I)
48
    {
49
        $I->wantTo('EF0601-UC01-T03 ログイン 異常パターン(入力ミス)');
50
        $I->logoutAsMember();
51
52
        $createCustomer = Fixtures::get('createCustomer');
53
        $customer = $createCustomer(null, false);
54
55
        $I->amOnPage('/mypage/login');
56
        $I->submitForm('#login_mypage', [
57
            'login_email' => $customer->getEmail().'.bad',
58
            'login_pass' => 'password'
59
        ]);
60
61
        $I->see('ログインできませんでした。', 'div.ec-login p.ec-errorMessage');
62
    }
63
64
    public function other_パスワード再発行(\AcceptanceTester $I)
65
    {
66
        $I->wantTo('EF0602-UC01-T01 パスワード再発行');
67
        $I->logoutAsMember();
68
        $BaseInfo = Fixtures::get('baseinfo');
0 ignored issues
show
$BaseInfo is not used, you could remove the assignment.

This check looks for variable assignements that are either overwritten by other assignments or where the variable is not used subsequently.

$myVar = 'Value';
$higher = false;

if (rand(1, 6) > 3) {
    $higher = true;
} else {
    $higher = false;
}

Both the $myVar assignment in line 1 and the $higher assignment in line 2 are dead. The first because $myVar is never used and the second because $higher is always overwritten for every possible time line.

Loading history...
69
70
        // TOPページ→ログイン(「ログイン情報をお忘れですか?」リンクを押下する)→パスワード再発行
71
        $I->amOnPage('/mypage/login');
72
        //$I->click('ログイン情報をお忘れですか', '#login_mypage #login_box .btn_area ul li a');
73
        $I->amOnPage('/forgot');
74
75
        // TOPページ>ログイン>パスワード再発行
76
        $I->see('パスワードの再発行', 'div.ec-pageHeader h1');
77
78
        // メールアドレスを入力する
79
        // 「次のページへ」ボタンを押下する
80
        $createCustomer = Fixtures::get('createCustomer');
81
        $customer = $createCustomer();
82
        $I->resetEmails();
83
        $I->submitForm('#form1', [
84
            'login_email' => $customer->getEmail()
85
        ]);
86
        $I->see('パスワード発行メールの送信 完了', 'div.ec-pageHeader h1');
87
88
        $I->seeEmailCount(1);
89
        $I->seeInLastEmailSubjectTo($customer->getEmail(), 'パスワード変更のご確認');
90
91
        $url = $I->grabFromLastEmailTo($customer->getEmail(), '@/forgot/reset/(.*)@');
92
93
        $I->resetEmails();
94
        $I->amOnPage($url);
95
        $I->see('パスワード再発行(再設定ページ)', 'div.ec-pageHeader h1');
96
97
        $password = substr(str_shuffle('1234567890abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'), 0, 20);
98
99
        // メルアド・新パスワード設定
100
        $I->submitForm('#form1',[
101
            'login_email' => $customer->getEmail(),
102
            'password[first]' => $password,
103
            'password[second]' => $password
104
        ]);
105
106
        $I->see('ログイン', 'div.ec-pageHeader h1');
107
        $I->loginAsMember($customer->getEmail(), $password);
108
    }
109
110 View Code Duplication
    public function other_ログアウト(\AcceptanceTester $I)
111
    {
112
        $I->wantTo('EF0603-UC01-T01 ログアウト');
113
        $I->logoutAsMember();
114
115
        $createCustomer = Fixtures::get('createCustomer');
116
        $customer = $createCustomer();
117
        $I->loginAsMember($customer->getEmail(), 'password');
118
119
        $I->logoutAsMember();
120
    }
121
122
    public function other_当サイトについて(\AcceptanceTester $I)
123
    {
124
        $I->wantTo('EF0604-UC01-T01 当サイトについて');
125
        $I->amOnPage('/');
126
127
        $I->click('.ec-footerNavi .ec-footerNavi__link:nth-child(1) a');
128
        $I->see('当サイトについて', 'div.ec-pageHeader h1');
129
        $baseinfo = Fixtures::get('baseinfo');
130
        $I->see($baseinfo->getShopName(), '#help_about_box__shop_name');
131
    }
132
133
    public function other_プライバシーポリシー(\AcceptanceTester $I)
134
    {
135
        $I->wantTo('EF0605-UC01-T01 プライバシーポリシー');
136
        $I->amOnPage('/');
137
138
        $I->click('.ec-footerNavi .ec-footerNavi__link:nth-child(2) a');
139
        $I->see('プライバシーポリシー', 'div.ec-pageHeader h1');
140
        $I->see('個人情報保護の重要性に鑑み、「個人情報の保護に関する法律」及び本プライバシーポリシーを遵守し、お客さまのプライバシー保護に努めます。', 'div.ec-layoutRole__main p:nth-child(1)');
141
    }
142
143
    public function other_特定商取引法に基づく表記(\AcceptanceTester $I)
144
    {
145
        $I->wantTo('EF0606-UC01-T01 特定商取引法に基づく表記');
146
        $I->amOnPage('/');
147
148
        $I->click('.ec-footerNavi .ec-footerNavi__link:nth-child(3) a');
149
        $I->see('特定商取引法に基づく表記', 'div.ec-pageHeader h1');
150
    }
151
152
    public function other_お問い合わせ1(\AcceptanceTester $I)
153
    {
154
        $I->wantTo('EF0607-UC01-T01 お問い合わせ');
155
        $I->amOnPage('/');
156
        $I->resetEmails();
157
        $faker = Fixtures::get('faker');
158
        $new_email = microtime(true).'.'.$faker->safeEmail;
159
        $BaseInfo = Fixtures::get('baseinfo');
160
161
        $I->click('.ec-footerNavi .ec-footerNavi__link:nth-child(4) a');
162
        $I->see('お問い合わせ', 'div.ec-pageHeader h1');
163
164
        $I->fillField(['id' => 'contact_name_name01'], '姓');
165
        $I->fillField(['id' => 'contact_name_name02'], '名');
166
        $I->fillField(['id' => 'contact_kana_kana01'], 'セイ');
167
        $I->fillField(['id' => 'contact_kana_kana02'], 'メイ');
168
        $I->fillField(['id' => 'contact_postal_code'], '530-0001');
169
        $I->selectOption(['id' => 'contact_address_pref'], ['value' => '27']);
170
        $I->fillField(['id' => 'contact_address_addr01'], '大阪市北区');
171
        $I->fillField(['id' => 'contact_address_addr02'], '梅田2-4-9 ブリーゼタワー13F');
172
        $I->fillField(['id' => 'contact_phone_number'], '111-111-111');
173
        $I->fillField(['id' => 'contact_email'], $new_email);
174
        $I->fillField(['id' => 'contact_contents'], 'お問い合わせ内容の送信');
175
        $I->click('div.ec-RegisterRole__actions button.ec-blockBtn--action');
176
177
        $I->see('お問い合わせ', 'div.ec-pageHeader h1');
178
        $I->click('div.ec-contactConfirmRole div.ec-RegisterRole__actions button.ec-blockBtn--action');
179
180
        // 完了ページ
181
        $I->see('お問い合わせ完了', 'div.ec-pageHeader h1');
182
183
        // メールチェック
184
        $I->seeEmailCount(2);
185 View Code Duplication
        foreach (array($new_email, $BaseInfo->getEmail01()) as $email) {
186
            $I->seeInLastEmailSubjectTo($email, 'お問い合わせを受け付けました');
187
            $I->seeInLastEmailTo($email, '姓 名 様');
188
            $I->seeInLastEmailTo($email, 'お問い合わせ内容の送信');
189
        }
190
    }
191
}
192