Failed Conditions
Branch experimental/sf (68db07)
by Kentaro
42:17 queued 33:39
created

EF05MypageCest::mypage_退会手続き未実施()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 19

Duplication

Lines 19
Ratio 100 %

Importance

Changes 0
Metric Value
cc 1
nc 1
nop 1
dl 19
loc 19
rs 9.6333
c 0
b 0
f 0
1
<?php
2
3
use Codeception\Util\Fixtures;
4
use Page\Front\CustomerAddressEditPage;
5
use Page\Front\CustomerAddressListPage;
6
use Page\Front\HistoryPage;
7
use Page\Front\MyPage;
8
use Page\Front\ProductDetailPage;
9
10
/**
11
 * @group front
12
 * @group mypage
13
 * @group ef5
14
 */
15
class EF05MypageCest
0 ignored issues
show
Coding Style Compatibility introduced by
PSR1 recommends that each class must be in a namespace of at least one level to avoid collisions.

You can fix this by adding a namespace to your class:

namespace YourVendor;

class YourClass { }

When choosing a vendor namespace, try to pick something that is not too generic to avoid conflicts with other libraries.

Loading history...
16
{
17
    public function _before(\AcceptanceTester $I)
0 ignored issues
show
Unused Code introduced by
The parameter $I is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
18
    {
19
    }
20
21
    public function _after(\AcceptanceTester $I)
0 ignored issues
show
Unused Code introduced by
The parameter $I is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
22
    {
23
    }
24
25 View Code Duplication
    public function mypage_初期表示(\AcceptanceTester $I)
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
Coding Style introduced by
Method name "EF05MypageCest::mypage_初期表示" is not in camel caps format
Loading history...
26
    {
27
        $I->wantTo('EF0501-UC01-T01 Mypage 初期表示');
28
        $createCustomer = Fixtures::get('createCustomer');
29
        $customer = $createCustomer();
30
        $I->loginAsMember($customer->getEmail(), 'password');
31
32
        MyPage::go($I);
33
        MyPage::at($I);
34
    }
35
36
    public function mypage_ご注文履歴_(\AcceptanceTester $I)
0 ignored issues
show
Coding Style introduced by
Method name "EF05MypageCest::mypage_ご注文履歴_" is not in camel caps format
Loading history...
37
    {
38
        $I->wantTo('EF0502-UC01-T01 Mypage ご注文履歴');
39
        $createCustomer = Fixtures::get('createCustomer');
40
        $customer = $createCustomer();
41
        $createOrders = Fixtures::get('createOrders');
42
        $Orders = $createOrders($customer);
0 ignored issues
show
Unused Code introduced by
$Orders 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...
43
44
        $I->loginAsMember($customer->getEmail(), 'password');
45
46
        // TOPページ>マイページ>ご注文履歴
47
        MyPage::go($I)->注文履歴();
48
49
        // 注文内容の状況/簡易情報が表示される、各注文履歴に「詳細を見る」ボタンが表示される
50
        $I->see('ご注文履歴', 'div.ec-pageHeader h1');
51
        $I->see('ご注文番号', 'div.ec-historyRole dl.ec-definitions');
52
        $I->see('詳細を見る', 'div.ec-historyRole p.ec-historyListHeader__action a');
53
    }
54
55
    public function mypage_ご注文履歴詳細(\AcceptanceTester $I)
0 ignored issues
show
Coding Style introduced by
Method name "EF05MypageCest::mypage_ご注文履歴詳細" is not in camel caps format
Loading history...
56
    {
57
        $I->wantTo('EF0503-UC01-T01 Mypage ご注文履歴詳細');
58
        $createCustomer = Fixtures::get('createCustomer');
59
        $customer = $createCustomer();
60
        $createOrders = Fixtures::get('createOrders');
61
        $createOrders($customer);
62
63
        $I->loginAsMember($customer->getEmail(), 'password');
64
65
        MyPage::go($I)->注文履歴詳細(1);
66
67
        HistoryPage::at($I);
68
69
        $I->see('ご注文状況', 'div.ec-orderOrder div.ec-definitions:nth-child(3) dt');
70
        // $I->see('注文受付', '#main_middle .order_detail'); TODO 受注ステータスが可変するためテストが通らない場合がある
71
        $I->see('配送情報', 'div.ec-orderRole div.ec-orderDelivery div.ec-rectHeading h2');
72
        $I->see('お届け先', 'div.ec-orderRole div.ec-orderDelivery div.ec-orderDelivery__title');
73
        $I->see('お支払方法', 'div.ec-orderRole div.ec-orderPayment div.ec-rectHeading h2');
74
        $I->see('お問い合わせ', 'div.ec-orderRole div.ec-orderConfirm div.ec-rectHeading h2');
75
        $I->see('メール配信履歴一覧', 'div.ec-orderRole div.ec-orderMails div.ec-rectHeading h2');
76
        $I->see('小計', 'div.ec-orderRole__summary div.ec-totalBox dl:nth-child(1)');
77
        $I->see('手数料', 'div.ec-orderRole__summary div.ec-totalBox dl:nth-child(2)');
78
        $I->see('送料', 'div.ec-orderRole__summary div.ec-totalBox dl:nth-child(3)');
79
        $I->see('合計', 'div.ec-orderRole__summary div.ec-totalBox .ec-totalBox__total');
80
    }
81
82
    public function mypage_お気に入り一覧(\AcceptanceTester $I)
0 ignored issues
show
Coding Style introduced by
Method name "EF05MypageCest::mypage_お気に入り一覧" is not in camel caps format
Loading history...
83
    {
84
        $I->wantTo('EF0508-UC01-T01 Mypage お気に入り一覧');
85
        $createCustomer = Fixtures::get('createCustomer');
86
        $customer = $createCustomer();
87
        $I->loginAsMember($customer->getEmail(), 'password');
88
89
        // TOPページ>マイページ>ご注文履歴
90
        MyPage::go($I)->お気に入り一覧();
91
92
        // 最初はなにも登録されていない
93
        $I->see('お気に入り一覧', 'div.ec-pageHeader h1');
94
        $I->see('お気に入りが登録されていません。', 'div.ec-favoriteRole');
95
96
        // お気に入り登録
97
        ProductDetailPage::go($I, 2)->お気に入りに追加();
98
99
        MyPage::go($I)->お気に入り一覧();
100
        $I->see('パーコレーター', 'ul.ec-favoriteRole__itemList li:nth-child(1) p.ec-favoriteRole__itemTitle');
101
102
        // お気に入りを削除
103
        $I->click('ul.ec-favoriteRole__itemList li:nth-child(1) a.ec-closeBtn--circle');
104
        $I->acceptPopup();
105
    }
106
107
    public function mypage_会員情報編集(\AcceptanceTester $I)
0 ignored issues
show
Coding Style introduced by
Method name "EF05MypageCest::mypage_会員情報編集" is not in camel caps format
Loading history...
108
    {
109
        $I->wantTo('EF0504-UC01-T01 Mypage 会員情報編集');
110
        $createCustomer = Fixtures::get('createCustomer');
111
        $customer = $createCustomer();
112
        $I->loginAsMember($customer->getEmail(), 'password');
113
        $faker = Fixtures::get('faker');
114
        $new_email = microtime(true).'.'.$faker->safeEmail;
115
116
        // TOPページ>マイページ>会員情報編集
117
        MyPage::go($I)->会員情報編集();
118
119
        // 会員情報フォームに既存の登録情報が表示される
120
        $I->seeInField(['id' => 'entry_name_name01'], $customer->getName01());
121
122
        $form = [
123
            'entry[name][name01]' => '姓05',
124
            'entry[name][name02]' => '名05',
125
            'entry[kana][kana01]' => 'セイ',
126
            'entry[kana][kana02]' => 'メイ',
127
            'entry[zip][zip01]' => '530',
128
            'entry[zip][zip02]' => '0001',
129
            'entry[address][pref]' => ['value' => '27'],
130
            'entry[address][addr01]' => '大阪市北区',
131
            'entry[address][addr02]' => '梅田2-4-9 ブリーゼタワー13F',
132
            'entry[tel][tel01]' => '111',
133
            'entry[tel][tel02]' => '111',
134
            'entry[tel][tel03]' => '111',
135
            'entry[email][first]' => $new_email,
136
            'entry[email][second]' => $new_email,
137
            'entry[password][first]' => 'password',
138
            'entry[password][second]' => 'password',
139
        ];
140
141
        $findPluginByCode = Fixtures::get('findPluginByCode');
142
        $Plugin = $findPluginByCode('MailMagazine');
143
        if ($Plugin) {
144
            $I->amGoingTo('メルマガプラグインを発見したため、メルマガを購読します');
145
            // 必須入力が効いてない https://github.com/EC-CUBE/mail-magazine-plugin/issues/29
146
            $form['entry[mailmaga_flg]'] = '1';
147
        }
148
        // 会員情報フォームに会員情報を入力する
149
        $I->submitForm("div.ec-editRole form", $form);
150
151
        // 会員情報編集(完了)画面が表示される
152
        $I->see('会員情報編集(完了)', 'div.ec-pageHeader h1');
153
154
        // 「トップページへ」ボタンを押下する
155
        $I->click('div.ec-registerCompleteRole a.ec-blockBtn--cancel');
156
157
        // TOPページヘ遷移する
158
        $I->see('新着情報', '.ec-news__title');
159
    }
160
161 View Code Duplication
    public function mypage_お届け先編集表示(\AcceptanceTester $I)
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
Coding Style introduced by
Method name "EF05MypageCest::mypage_お届け先編集表示" is not in camel caps format
Loading history...
162
    {
163
        $I->wantTo('EF0506-UC01-T01 Mypage お届け先編集表示');
164
        $createCustomer = Fixtures::get('createCustomer');
165
        $customer = $createCustomer();
166
        $I->loginAsMember($customer->getEmail(), 'password');
167
168
        // TOPページ>マイページ>お届け先編集
169
        MyPage::go($I)->お届け先編集();
170
171
        $I->see('お届け先編集', 'div.ec-pageHeader h1');
172
    }
173
174
    public function mypage_お届け先編集作成変更(\AcceptanceTester $I)
0 ignored issues
show
Coding Style introduced by
Method name "EF05MypageCest::mypage_お届け先編集作成変更" is not in camel caps format
Loading history...
175
    {
176
        $I->wantTo('EF0506-UC01-T02 Mypage お届け先編集作成変更');
177
        $createCustomer = Fixtures::get('createCustomer');
178
        $customer = $createCustomer();
179
        $I->loginAsMember($customer->getEmail(), 'password');
180
181
        // お届先作成
182
        // TOPページ>マイページ>お届け先編集
183
        MyPage::go($I)
184
            ->お届け先編集()
185
            ->追加();
186
187
        // 入力 & submit
188
        CustomerAddressEditPage::at($I)
189
            ->入力_姓('姓05')
190
            ->入力_名('名05')
191
            ->入力_セイ('セイ')
192
            ->入力_メイ('メイ')
193
            ->入力_郵便番号1('530')
194
            ->入力_郵便番号2('0001')
195
            ->入力_都道府県(['value' => '27'])
196
            ->入力_市区町村名('大阪市北区')
197
            ->入力_番地_ビル名('梅田2-4-9 ブリーゼタワー13F')
198
            ->入力_電話番号1('111')
199
            ->入力_電話番号2('111')
200
            ->入力_電話番号3('111')
201
            ->登録する();
202
203
        // お届け先編集ページ
204
        CustomerAddressListPage::at($I);
205
206
        // 一覧に追加されている
207
        $I->see('大阪市北区', 'div.ec-addressList div:nth-child(1) div.ec-addressList__address');
208
209
        // お届先編集
210
        // TOPページ>マイページ>お届け先編集
211
        MyPage::go($I)
212
            ->お届け先編集()
213
            ->変更(1);
214
215
        CustomerAddressEditPage::at($I)
216
            ->入力_姓('姓05')
217
            ->入力_名('名05')
218
            ->入力_セイ('セイ')
219
            ->入力_メイ('メイ')
220
            ->入力_郵便番号1('530')
221
            ->入力_郵便番号2('0001')
222
            ->入力_都道府県(['value' => '27'])
223
            ->入力_市区町村名('大阪市南区')
224
            ->入力_番地_ビル名('梅田2-4-9 ブリーゼタワー13F')
225
            ->入力_電話番号1('111')
226
            ->入力_電話番号2('111')
227
            ->入力_電話番号3('111')
228
            ->登録する();
229
230
        // お届け先編集ページ
231
        CustomerAddressListPage::at($I);
232
233
        // 一覧に反映されている
234
        $I->see('大阪市南区', 'div.ec-addressList div:nth-child(1) div.ec-addressList__address');
235
    }
236
237
    public function mypage_お届け先編集削除(\AcceptanceTester $I)
0 ignored issues
show
Coding Style introduced by
Method name "EF05MypageCest::mypage_お届け先編集削除" is not in camel caps format
Loading history...
238
    {
239
        $I->wantTo('EF0503-UC01-T01 Mypage お届け先編集削除');
240
        $createCustomer = Fixtures::get('createCustomer');
241
        $customer = $createCustomer();
242
        $I->loginAsMember($customer->getEmail(), 'password');
243
244
        // TOPページ>マイページ>お届け先編集
245
        MyPage::go($I)->お届け先編集()->追加();
246
247
        CustomerAddressEditPage::at($I)
248
            ->入力_姓('姓0501')
249
            ->入力_名('名0501')
250
            ->入力_セイ('セイ')
251
            ->入力_メイ('メイ')
252
            ->入力_郵便番号1('530')
253
            ->入力_郵便番号2('0001')
254
            ->入力_都道府県(['value' => '27'])
255
            ->入力_市区町村名('大阪市西区')
256
            ->入力_番地_ビル名('梅田2-4-9 ブリーゼタワー13F')
257
            ->入力_電話番号1('111')
258
            ->入力_電話番号2('111')
259
            ->入力_電話番号3('111')
260
            ->登録する();
261
262
        $I->see('大阪市西区', 'div.ec-addressList div:nth-child(1) div.ec-addressList__address');
263
264
        CustomerAddressListPage::at($I)
265
            ->削除(1);
266
267
        // 確認
268
        $I->see('0 件', 'div.ec-layoutRole div.ec-layoutRole__contents p.ec-para-nomal strong');
269
    }
270
271 View Code Duplication
    public function mypage_退会手続き未実施(\AcceptanceTester $I)
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
Coding Style introduced by
Method name "EF05MypageCest::mypage_退会手続き未実施" is not in camel caps format
Loading history...
272
    {
273
        $I->wantTo('EF0507-UC03-T01 Mypage 退会手続き 未実施');
274
        $createCustomer = Fixtures::get('createCustomer');
275
        $customer = $createCustomer();
276
        $I->loginAsMember($customer->getEmail(), 'password');
277
278
        // TOPページ>マイページ>退会手続き
279
        MyPage::go($I)
280
            ->退会手続き();
281
282
        // 会員退会手続きへ
283
        $I->click('div.ec-withdrawRole form button');
284
285
        // 未実施
286
        $I->click('div.ec-withdrawConfirmRole form a.ec-withdrawConfirmRole__cancel');
287
288
        MyPage::at($I);
289
    }
290
291
    public function mypage_退会手続き(\AcceptanceTester $I)
0 ignored issues
show
Coding Style introduced by
Method name "EF05MypageCest::mypage_退会手続き" is not in camel caps format
Loading history...
292
    {
293
        $I->wantTo('EF0507-UC03-T02 Mypage 退会手続き');
294
        $createCustomer = Fixtures::get('createCustomer');
295
        $customer = $createCustomer();
296
        $I->loginAsMember($customer->getEmail(), 'password');
297
298
        // TOPページ>マイページ>お届け先編集
299
        MyPage::go($I)
300
            ->退会手続き();
301
302
        // 会員退会手続きへ
303
        $I->click('div.ec-withdrawRole form button');
304
305
        // 実施
306
        $I->click('div.ec-withdrawConfirmRole form button');
307
        $I->see('退会手続き', 'div.ec-pageHeader h1');
308
        $I->see('退会が完了いたしました', 'div.ec-withdrawCompleteRole div.ec-reportHeading');
309
        $I->click('div.ec-withdrawCompleteRole a.ec-blockBtn--cancel');
310
311
        // TOPページヘ遷移する
312
        $I->see('新着情報', '.ec-news__title');
313
    }
314
}
315