Failed Conditions
Pull Request — experimental/sf (#3241)
by k-yamamura
43:19 queued 23:09
created

EF03OrderCest::order_ログインユーザ購入()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 45

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 2
nc 2
nop 1
dl 0
loc 45
rs 9.2
c 0
b 0
f 0
1
<?php
2
3
use Codeception\Util\Fixtures;
4
use Page\Front\CartPage;
5
use Page\Front\ProductDetailPage;
6
use Page\Front\ShippingEditPage;
7
use Page\Front\ShoppingCompletePage;
8
use Page\Front\ShoppingConfirmPage;
9
use Page\Front\ShoppingLoginPage;
10
use Page\Front\ShoppingPage;
11
use Page\Front\MultipleShippingPage;
12
use Page\Front\CustomerAddressAddPage;
13
14
/**
15
 * @group front
16
 * @group order
17
 * @group ef3
18
 */
19
class EF03OrderCest
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...
20
{
21
    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...
22
    {
23
    }
24
25
    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...
26
    {
27
    }
28
29
    public function order_カート買い物を続ける(\AcceptanceTester $I)
0 ignored issues
show
Coding Style introduced by
Method name "EF03OrderCest::order_カート買い物を続ける" is not in camel caps format
Loading history...
30
    {
31
        $I->wantTo('EF0301-UC01-T01 カート 買い物を続ける');
32
        $createCustomer = Fixtures::get('createCustomer');
33
        $customer = $createCustomer();
34
        $I->loginAsMember($customer->getEmail(), 'password');
35
36
        // 商品詳細パーコレータ カートへ
37
        ProductDetailPage::go($I, 2)
38
            ->カートに入れる(1);
39
40
        $I->acceptPopup();
41
42
        CartPage::go($I)
43
            ->お買い物を続ける();
44
45
        // トップページ
46
        $I->see('新着情報', '.ec-news__title');
47
    }
48
49 View Code Duplication
    public function order_カート削除(\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 "EF03OrderCest::order_カート削除" is not in camel caps format
Loading history...
50
    {
51
        $I->wantTo('EF0301-UC01-T02 カート 削除');
52
        $createCustomer = Fixtures::get('createCustomer');
53
        $customer = $createCustomer();
54
        $I->loginAsMember($customer->getEmail(), 'password');
55
56
        ProductDetailPage::go($I, 2)
57
            ->カートに入れる(1);
58
59
        $I->acceptPopup();
60
61
        CartPage::go($I)
62
            ->商品削除(1);
63
    }
64
65 View Code Duplication
    public function order_カート数量増やす(\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 "EF03OrderCest::order_カート数量増やす" is not in camel caps format
Loading history...
66
    {
67
        $I->wantTo('EF0301-UC01-T03 カート 数量増やす');
68
69
        $createCustomer = Fixtures::get('createCustomer');
70
        $customer = $createCustomer();
71
        $I->loginAsMember($customer->getEmail(), 'password');
72
73
        // 商品詳細パーコレータ カートへ
74
        ProductDetailPage::go($I, 2)
75
            ->カートに入れる(1);
76
77
        $I->acceptPopup();
78
79
        $cartPage = CartPage::go($I)
80
            ->商品数量増やす(1);
81
82
        // 確認
83
        $I->assertEquals('2', $cartPage->商品数量(1));
84
85
    }
86
87 View Code Duplication
    public function order_カート数量減らす(\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 "EF03OrderCest::order_カート数量減らす" is not in camel caps format
Loading history...
88
    {
89
        $I->wantTo('EF0301-UC01-T04 カート 数量減らす');
90
        $createCustomer = Fixtures::get('createCustomer');
91
        $customer = $createCustomer();
92
        $I->loginAsMember($customer->getEmail(), 'password');
93
94
        // 商品詳細パーコレータ カートへ
95
        ProductDetailPage::go($I, 2)
96
            ->カートに入れる(2);
97
98
        $I->acceptPopup();
99
100
        $cartPage = CartPage::go($I)
101
            ->商品数量減らす(1);
102
103
        // 確認
104
        $I->assertEquals('1', $cartPage->商品数量(1));
105
    }
106
107
    public function order_ログインユーザ購入(\AcceptanceTester $I)
0 ignored issues
show
Coding Style introduced by
Method name "EF03OrderCest::order_ログインユーザ購入" is not in camel caps format
Loading history...
108
    {
109
        $I->wantTo('EF0302-UC01-T01 ログインユーザ購入');
110
        $I->logoutAsMember();
111
        $createCustomer = Fixtures::get('createCustomer');
112
        $customer = $createCustomer();
113
        $BaseInfo = Fixtures::get('baseinfo');
114
115
        // 商品詳細パーコレータ カートへ
116
        ProductDetailPage::go($I, 2)
117
            ->カートに入れる(1);
118
119
        $I->acceptPopup();
120
121
        CartPage::go($I)
122
            ->レジに進む();
123
124
        // ログイン
125
        ShoppingLoginPage::at($I)->ログイン($customer->getEmail());
126
127
        $I->resetEmails();
128
129
        ShoppingPage::at($I)->確認する();
130
        ShoppingConfirmPage::at($I)->注文する();
131
132
        $I->wait(1);
133
134
        // メール確認
135
        $I->seeEmailCount(2);
136
        foreach (array($customer->getEmail(), $BaseInfo->getEmail01()) as $email) {
137
            // TODO 注文した商品の内容もチェックしたい
138
            $I->seeInLastEmailSubjectTo($email, 'ご注文ありがとうございます');
139
            $I->seeInLastEmailTo($email, $customer->getName01().' '.$customer->getName02().' 様');
140
            $I->seeInLastEmailTo($email, 'お名前 :'.$customer->getName01().' '.$customer->getName02().' 様');
141
            $I->seeInLastEmailTo($email, 'お名前(フリガナ):'.$customer->getKana01().' '.$customer->getKana02().' 様');
142
            $I->seeInLastEmailTo($email, '郵便番号:〒'.$customer->getPostalCode());
143
            $I->seeInLastEmailTo($email, '住所  :'.$customer->getPref()->getName().$customer->getAddr01().$customer->getAddr02());
144
            $I->seeInLastEmailTo($email, '電話番号:'.$customer->getPhoneNumber());
145
            $I->seeInLastEmailTo($email, 'メールアドレス:'.$customer->getEmail());
146
        }
147
148
        // 完了画面 -> topへ
149
        ShoppingCompletePage::at($I)->TOPへ();
150
        $I->see('新着情報', '.ec-news__title');
151
    }
152
153
    public function order_ゲスト購入(\AcceptanceTester $I)
0 ignored issues
show
Coding Style introduced by
Method name "EF03OrderCest::order_ゲスト購入" is not in camel caps format
Loading history...
154
    {
155
        $I->wantTo('EF0302-UC02-T01 ゲスト購入');
156
        $I->logoutAsMember();
157
158
        $faker = Fixtures::get('faker');
159
        $new_email = microtime(true).'.'.$faker->safeEmail;
160
        $BaseInfo = Fixtures::get('baseinfo');
161
162
        ProductDetailPage::go($I, 2)
163
            ->カートに入れる(1);
164
165
        $I->acceptPopup();
166
167
        CartPage::go($I)
168
            ->レジに進む();
169
170
        $ShoppingPage = ShoppingLoginPage::at($I)->ゲスト購入();
171
        $ShoppingPage
172
            ->入力_姓('姓03')
173
            ->入力_名('名03')
174
            ->入力_セイ('セイ')
175
            ->入力_メイ('メイ')
176
            ->入力_郵便番号('530-0001');
177
178
        // TODO: 郵便番号入力後のcodeceptionの入力後にJSが走ってしまい「梅田」が2重で入力されてしまう。
179
        // 上記を回避するためにwait関数を入れる。
180
        // こちらは本体のmasterブランチで修正されているので、master -> sf マージ後には不要になる見込み。
181
        $I->wait(5);
182
183
        $ShoppingPage
184
            ->入力_都道府県(['value' => '27'])
185
            ->入力_市区町村名('大阪市北区')
186
            ->入力_番地_ビル名('梅田2-4-9 ブリーゼタワー13F')
187
            ->入力_電話番号('111-111-111')
188
            ->入力_Eメール($new_email)
189
            ->入力_Eメール確認($new_email)
190
            ->次へ();
191
192
        $I->resetEmails();
193
194
        ShoppingPage::at($I)->確認する();
195
        ShoppingConfirmPage::at($I)->注文する();
196
197
        $I->wait(1);
198
199
        // 確認
200
        $I->seeEmailCount(2);
201 View Code Duplication
        foreach ([$new_email, $BaseInfo->getEmail01()] as $email) {
202
            // TODO 注文した商品の内容もチェックしたい
203
            $I->seeInLastEmailSubjectTo($email, 'ご注文ありがとうございます');
204
            $I->seeInLastEmailTo($email, '姓03 名03 様');
205
            $I->seeInLastEmailTo($email, 'お名前 :姓03 名03 様');
206
            $I->seeInLastEmailTo($email, 'お名前(フリガナ):セイ メイ 様');
207
            $I->seeInLastEmailTo($email, '郵便番号:〒5300001');
208
            $I->seeInLastEmailTo($email, '住所  :大阪府大阪市北区梅田2-4-9 ブリーゼタワー13F');
209
            $I->seeInLastEmailTo($email, '電話番号:111111111');
210
            $I->seeInLastEmailTo($email, 'メールアドレス:'.$new_email);
211
        }
212
213
        // 完了画面 -> topへ
214
        ShoppingCompletePage::at($I)->TOPへ();
215
        $I->see('新着情報', '.ec-news__title');
216
    }
217
218
    public function order_ゲスト購入情報変更(\AcceptanceTester $I)
0 ignored issues
show
Coding Style introduced by
Method name "EF03OrderCest::order_ゲスト購入情報変更" is not in camel caps format
Loading history...
219
    {
220
        $I->wantTo('EF0305-UC02-T01 ゲスト購入 情報変更'); // EF0305-UC04-T01も一緒にテスト
221
        $I->logoutAsMember();
222
223
        $faker = Fixtures::get('faker');
224
        $new_email = microtime(true).'.'.$faker->safeEmail;
225
        $BaseInfo = Fixtures::get('baseinfo');
226
227
        // 商品詳細パーコレータ カートへ
228
        ProductDetailPage::go($I, 2)
229
            ->カートに入れる(1);
230
231
        $I->acceptPopup();
232
233
        CartPage::go($I)
234
            ->レジに進む();
235
236
        $ShoppingPage = ShoppingLoginPage::at($I)->ゲスト購入();
237
        $ShoppingPage
238
            ->入力_姓('姓03')
239
            ->入力_名('名03')
240
            ->入力_セイ('セイ')
241
            ->入力_メイ('メイ')
242
            ->入力_郵便番号('530-0001');
243
244
        // TODO: 郵便番号入力後のcodeceptionの入力後にJSが走ってしまい「梅田」が2重で入力されてしまう。
245
        // 上記を回避するためにwait関数を入れる。
246
        // こちらは本体のmasterブランチで修正されているので、master -> sf マージ後には不要になる見込み。
247
        $I->wait(5);
248
249
        $ShoppingPage
250
            ->入力_都道府県(['value' => '27'])
251
            ->入力_市区町村名('大阪市北区')
252
            ->入力_番地_ビル名('梅田2-4-9 ブリーゼタワー13F')
253
            ->入力_電話番号('111-111-111')
254
            ->入力_Eメール($new_email)
255
            ->入力_Eメール確認($new_email)
256
            ->次へ();
257
258
        // 確認
259
        $ShoppingPage = ShoppingPage::at($I)
260
            ->お客様情報変更()
261
            ->入力_姓('姓0301')
262
            ->お客様情報変更OK();
263
264
        // 確認
265
        $I->see('姓0301', '#shopping-form .customer-name01');
266
267
        // 配送情報
268
        $ShoppingPage->お届け先変更();
269
270
        ShippingEditPage::at($I)
271
            ->入力_姓('姓0302')
272
            ->登録する();
273
274
        $I->see('姓0302', 'div.ec-orderRole div.ec-orderDelivery__address');
275
276
        $I->resetEmails();
277
278
        ShoppingPage::at($I)->確認する();
279
        ShoppingConfirmPage::at($I)->注文する();
280
281
        $I->seeEmailCount(2);
282 View Code Duplication
        foreach ([$new_email, $BaseInfo->getEmail01()] as $email) {
283
            // TODO 注文した商品の内容もチェックしたい
284
            $I->seeInLastEmailSubjectTo($email, 'ご注文ありがとうございます');
285
            $I->seeInLastEmailTo($email, '姓0301 名03 様');
286
            $I->seeInLastEmailTo($email, 'お名前 :姓0302 名03 様', '変更後のお届け先');
287
            $I->seeInLastEmailTo($email, '郵便番号:〒5300001');
288
            $I->seeInLastEmailTo($email, '住所  :大阪府大阪市北区梅田2-4-9 ブリーゼタワー13F');
289
            $I->seeInLastEmailTo($email, '電話番号:111111111');
290
            $I->seeInLastEmailTo($email, 'メールアドレス:'.$new_email);
291
        }
292
293
        // topへ
294
        ShoppingCompletePage::at($I)->TOPへ();
295
        $I->see('新着情報', '.ec-news__title');
296
    }
297
298
    /**
0 ignored issues
show
introduced by
Doc comment for parameter "$I" missing
Loading history...
299
     * @see https://github.com/EC-CUBE/ec-cube/pull/3133
300
     */
301
    public function order_ログインしてカートをマージ(\AcceptanceTester $I)
0 ignored issues
show
Coding Style introduced by
Method name "EF03OrderCest::order_ログインしてカートをマージ" is not in camel caps format
Loading history...
302
    {
303
        $I->wantTo('EF0305-UC07-T01 ログインしてカートをマージ');
304
        $I->logoutAsMember();
305
        $createCustomer = Fixtures::get('createCustomer');
306
        $customer = $createCustomer();
307
        $BaseInfo = Fixtures::get('baseinfo');
308
309
        // 商品詳細パーコレータ カートへ
310
        ProductDetailPage::go($I, 2)
311
            ->カートに入れる(1);
312
313
        $I->acceptPopup();
314
315
        CartPage::go($I)
316
            ->レジに進む();
317
318
        // ログイン
319
        ShoppingLoginPage::at($I)->ログイン($customer->getEmail());
320
321
        $I->resetEmails();
322
323
        ShoppingPage::at($I)->確認する();
324
        $I->logoutAsMember();
325
326
        // 商品詳細フォーク カートへ
327
        ProductDetailPage::go($I, 1)
328
            ->規格選択(['プラチナ', '150cm'])
329
            ->カートに入れる(1);
330
331
        $I->acceptPopup();
332
333
        CartPage::go($I)
334
            ->レジに進む();
335
336
        // ログイン
337
        ShoppingLoginPage::at($I)->ログイン($customer->getEmail());
338
339
        ShoppingPage::at($I)->確認する();
340
        ShoppingConfirmPage::at($I)->注文する();
341
342
        $I->wait(1);
343
344
        // メール確認
345
        $I->seeEmailCount(2);
346
        foreach ([$customer->getEmail(), $BaseInfo->getEmail01()] as $email) {
347
            $I->seeInLastEmailSubjectTo($email, 'ご注文ありがとうございます');
348
            $I->seeInLastEmailTo($email, $customer->getName01().' '.$customer->getName02().' 様');
349
            $I->seeInLastEmailTo($email, 'お名前 :'.$customer->getName01().' '.$customer->getName02().' 様');
350
            $I->seeInLastEmailTo($email, 'お名前(フリガナ):'.$customer->getKana01().' '.$customer->getKana02().' 様');
351
            $I->seeInLastEmailTo($email, '郵便番号:〒'.$customer->getPostalCode());
352
            $I->seeInLastEmailTo($email, '住所  :'.$customer->getPref()->getName().$customer->getAddr01().$customer->getAddr02());
353
            $I->seeInLastEmailTo($email, '電話番号:'.$customer->getPhoneNumber());
354
            $I->seeInLastEmailTo($email, 'メールアドレス:'.$customer->getEmail());
355
356
            $I->seeInLastEmailTo($email, '商品名: パーコレーター');
357
            $I->seeInLastEmailTo($email, '商品名: ディナーフォーク  プラチナ  150cm');
358
        }
359
360
        // 完了画面 -> topへ
361
        ShoppingCompletePage::at($I)->TOPへ();
362
        $I->see('新着情報', '.ec-news__title');
363
    }
364
365
    public function order_ログインユーザ購入複数配送(\AcceptanceTester $I)
0 ignored issues
show
Coding Style introduced by
Method name "EF03OrderCest::order_ログインユーザ購入複数配送" is not in camel caps format
Loading history...
366
    {
367
        // チェック用変数
368
        // 追加するお届け作の名前
369
        $nameSei = '姓0302';
370
        $nameMei = '名0302';
371
        // カートへ入れる商品の数
372
        $cart_quantity = 1;
373
        // お届け先ごとに設定する商品の数
374
        $shipping1_quantity = 2;
375
        $shipping2_quantity = 3;
376
377
        $I->wantTo('EF0305-UC05-T01 お届け先の追加');
378
        $I->logoutAsMember();
379
        $createCustomer = Fixtures::get('createCustomer');
380
        /** @var \Eccube\Entity\CustomerAddress $customer */
381
        $customer = $createCustomer();
382
        $BaseInfo = Fixtures::get('baseinfo');
383
384
        // 商品詳細パーコレータ カートへ
385
        ProductDetailPage::go($I, 2)
386
            ->カートに入れる($cart_quantity);
387
388
        $I->acceptPopup();
389
390
        CartPage::go($I)
391
            ->レジに進む();
392
393
        // ログイン
394
        ShoppingLoginPage::at($I)->ログイン($customer->getEmail());
395
396
        $I->resetEmails();
397
398
        // -------- EF0305-UC05-T01_お届け先の追加 --------
399
        ShoppingPage::at($I)->お届け先追加();
400
401
        // 新規お届け先追加
402
        MultipleShippingPage::at($I)->新規お届け先を追加する();
403
        CustomerAddressAddPage::at($I)
404
            ->入力_姓($nameSei)
405
            ->入力_名($nameMei)
406
            ->入力_セイ('セイ')
407
            ->入力_メイ('メイ')
408
            ->入力_郵便番号('530-0001')
409
            ->入力_都道府県(['value' => '27'])
410
            ->入力_市区町村名('大阪市北区2')
411
            ->入力_番地_ビル名('梅田2-4-9 ブリーゼタワー13F2')
412
            ->入力_電話番号('222-222-222')
413
            ->登録する();
414
415
        // 新規お届け先が追加されていることを確認
416
        $I->see($nameSei, '#form_shipping_multiple_0_shipping_0_customer_address > option:nth-child(2)');
417
418
        // -------- EF0305-UC06-T01_複数配送 - 同じ商品種別(同一配送先) --------
419
        // 複数配送設定
420
        MultipleShippingPage::at($I)
421
            ->お届け先追加()
422
            ->入力_お届け先('0', '0', $customer->getName01())
423
            ->入力_お届け先('0', '1', $customer->getName01())
424
            ->入力_数量('0', '0', $shipping1_quantity)
425
            ->入力_数量('0', '1', $shipping2_quantity)
426
            ->選択したお届け先に送る()
427
        ;
428
429
        // 配送先が1個なので数量をまとめる
430
        $sum_quantity = $shipping1_quantity + $shipping2_quantity;
431
432
        // 複数配送設定がされておらず、個数が1明細にまとめられていることを確認
433
        $I->see('お届け先', '#shopping-form > div > div.ec-orderRole__detail > div.ec-orderDelivery > div:nth-child(2)');
434
        $I->dontSee('お届け先(1)', '#shopping-form > div > div.ec-orderRole__detail > div.ec-orderDelivery > div:nth-child(2)');
435
        $I->dontSee('お届け先(2)', '#shopping-form > div > div.ec-orderRole__detail > div.ec-orderDelivery > div:nth-child(6)');
436
        $I->see(' × '.$sum_quantity, '#shopping-form > div > div.ec-orderRole__detail > div.ec-orderDelivery > div:nth-child(3) > ul > li:nth-child(1) > div > div.ec-imageGrid__content > p:nth-child(2)');
437
        $I->see($customer->getName01(), '#shopping-form > div > div.ec-orderRole__detail > div.ec-orderDelivery > div:nth-child(4) > p:nth-child(1)');
438
439
        // -------- EF0305-UC06-T02_複数配送 - 同じ商品種別(別配送先) --------
440
441
        ShoppingPage::at($I)->お届け先追加();
442
443
        // 複数配送設定
444
        MultipleShippingPage::at($I)
445
            ->お届け先追加()
446
            ->入力_お届け先('0', '0', $customer->getName01())
447
            ->入力_お届け先('0', '1', $nameSei)
448
            ->入力_数量('0', '0', $shipping1_quantity)
449
            ->入力_数量('0', '1', $shipping2_quantity)
450
            ->選択したお届け先に送る()
451
        ;
452
453
        // 名前を比較してお届け先が上下どちらに表示されるか判断
454
        $compared = strnatcmp($customer->getName01(), $nameSei);
455
        if ($compared === 0) {
456
            $compared = strnatcmp($customer->getName02(), $nameMei);
457
        }
458
        // 上下それぞれで名前、商品個数を設定
459 View Code Duplication
        if ($compared < 0) {
460
            $quantity1 = $shipping1_quantity;
461
            $quantity2 = $shipping2_quantity;
462
            $name1 = $customer->getName01();
463
            $name2 = $nameSei;
464
        } else {
465
            $quantity1 = $shipping2_quantity;
466
            $quantity2 = $shipping1_quantity;
467
            $name1 = $nameSei;
468
            $name2 = $customer->getName01();
469
        }
470
471
        // 複数配送設定ができていることを確認
472
        $I->see('お届け先(1)', '#shopping-form > div > div.ec-orderRole__detail > div.ec-orderDelivery > div:nth-child(2)');
473
        $I->see(' × '.$quantity1, '#shopping-form > div > div.ec-orderRole__detail > div.ec-orderDelivery > div:nth-child(3) > ul > li:nth-child(1) > div > div.ec-imageGrid__content > p:nth-child(2)');
474
        $I->see($name1, '#shopping-form > div > div.ec-orderRole__detail > div.ec-orderDelivery > div:nth-child(4) > p:nth-child(1)');
475
        $I->see('お届け先(2)', '#shopping-form > div > div.ec-orderRole__detail > div.ec-orderDelivery > div:nth-child(6)');
476
        $I->see(' × '.$quantity2, '#shopping-form > div > div.ec-orderRole__detail > div.ec-orderDelivery > div:nth-child(7) > ul > li:nth-child(1) > div > div.ec-imageGrid__content > p:nth-child(2)');
477
        $I->see($name2, '#shopping-form > div > div.ec-orderRole__detail > div.ec-orderDelivery > div:nth-child(8) > p:nth-child(1)');
478
479
        ShoppingPage::at($I)->確認する();
480
        ShoppingConfirmPage::at($I)->注文する();
481
482
        $I->wait(1);
483
484
        // メール確認
485
        $I->seeEmailCount(2);
486 View Code Duplication
        foreach ([$customer->getEmail(), $BaseInfo->getEmail01()] as $email) {
487
            $I->seeInLastEmailSubjectTo($email, 'ご注文ありがとうございます');
488
            $I->seeInLastEmailTo($email, $customer->getName01().' '.$customer->getName02().' 様');
489
            $I->seeInLastEmailTo($email, 'お名前 :'.$customer->getName01().' '.$customer->getName02().' 様');
490
            $I->seeInLastEmailTo($email, 'お名前(フリガナ):'.$customer->getKana01().' '.$customer->getKana02().' 様');
491
            $I->seeInLastEmailTo($email, '郵便番号:〒'.$customer->getPostalCode());
492
            $I->seeInLastEmailTo($email, '住所  :'.$customer->getPref()->getName().$customer->getAddr01().$customer->getAddr02());
493
            $I->seeInLastEmailTo($email, '電話番号:'.$customer->getPhoneNumber());
494
            $I->seeInLastEmailTo($email, 'メールアドレス:'.$customer->getEmail());
495
            $I->seeInLastEmailTo($email, '◎お届け先1');
496
            $I->seeInLastEmailTo($email, 'お名前 :'.$nameSei);
497
            $I->seeInLastEmailTo($email, '数量:3');
498
            $I->seeInLastEmailTo($email, '◎お届け先2');
499
            $I->seeInLastEmailTo($email, '数量:2');
500
        }
501
502
        // 完了画面 -> topへ
503
        ShoppingCompletePage::at($I)->TOPへ();
504
        $I->see('新着情報', '.ec-news__title');
505
    }
506
507
    public function order_ログイン後に複数カートになればカートに戻す(\AcceptanceTester $I)
0 ignored issues
show
Coding Style introduced by
Method name "EF03OrderCest::order_ログイン後に複数カートになればカートに戻す" is not in camel caps format
Loading history...
508
    {
509
        $I->wantTo('EF0303-UC01-T01_購入フローでログインしたタイミングで複数カートになったらログイン後にカート画面に戻す');
510
        $I->logoutAsMember();
511
        $createCustomer = Fixtures::get('createCustomer');
512
        $customer = $createCustomer();
513
        $I->loginAsMember($customer->getEmail(), 'password');
514
515
        // 商品詳細パーコレータ カートへ
516
        ProductDetailPage::go($I, 2)
517
            ->カートに入れる(1);
518
519
        $I->wait(3);
520
521
        $I->acceptPopup();
522
523
        CartPage::go($I)
524
            ->レジに進む();
525
526
        // ログアウト
527
        $I->logoutAsMember();
528
529
        $createProduct = Fixtures::get('createProduct');
530
        $Product = $createProduct();
531
532
        $entityManager = Fixtures::get('entityManager');
533
        $ProductClass = $Product->getProductClasses()[0];
534
        $SaleType = $entityManager->find(\Eccube\Entity\Master\SaleType::class, 2);
535
        $ProductClass->setSaleType($SaleType);
536
        $entityManager->persist($ProductClass);
537
        $entityManager->flush();
538
539
        if ($ProductClass->getClassCategory2()) {
540
            // 商品詳細
541
            ProductDetailPage::go($I, $Product->getId())
542
                ->規格選択([$ProductClass->getClassCategory1(), $ProductClass->getClassCategory2()])
543
                ->カートに入れる(1);
544
        } else {
545
            ProductDetailPage::go($I, $Product->getId())
546
                ->規格選択([$ProductClass->getClassCategory1()])
547
                ->カートに入れる(1);
548
        }
549
550
        $I->wait(3);
551
        $I->acceptPopup();
552
553
        CartPage::go($I)
554
            ->レジに進む();
555
556
        // ログイン
557
        ShoppingLoginPage::at($I)->ログイン($customer->getEmail());
558
559
        $I->see('同時購入できない商品がカートに含まれています', '.ec-alert-warning__text');
560
    }
561
562
    /**
0 ignored issues
show
introduced by
Doc comment for parameter "$I" missing
Loading history...
563
     * カートに変更が無ければ、お届け先の設定が引き継がれる.
564
     */
565
    public function order_購入確認画面からカートに戻る(\AcceptanceTester $I)
0 ignored issues
show
Coding Style introduced by
Method name "EF03OrderCest::order_購入確認画面からカートに戻る" is not in camel caps format
Loading history...
566
    {
567
        // チェック用変数
568
        // 追加するお届け作の名前
569
        $nameSei = '姓0302';
570
        $nameMei = '名0302';
571
        // カートへ入れる商品の数
572
        $cart_quantity = 1;
573
        // お届け先ごとに設定する商品の数
574
        $shipping1_quantity = 2;
575
        $shipping2_quantity = 3;
576
577
        $I->wantTo('EF0305-UC08-T01 購入確認画面からカートに戻る');
578
        $I->logoutAsMember();
579
        $createCustomer = Fixtures::get('createCustomer');
580
        /** @var \Eccube\Entity\CustomerAddress $customer */
581
        $customer = $createCustomer();
582
        $BaseInfo = Fixtures::get('baseinfo');
583
584
        // 商品詳細パーコレータ カートへ
585
        ProductDetailPage::go($I, 2)
586
            ->カートに入れる($cart_quantity);
587
588
        $I->acceptPopup();
589
590
        CartPage::go($I)
591
            ->レジに進む();
592
593
        // ログイン
594
        ShoppingLoginPage::at($I)->ログイン($customer->getEmail());
595
596
        $I->resetEmails();
597
598
        // -------- EF0305-UC05-T01_お届け先の追加 --------
599
        ShoppingPage::at($I)->お届け先追加();
600
601
        // 新規お届け先追加
602
        MultipleShippingPage::at($I)->新規お届け先を追加する();
603
        CustomerAddressAddPage::at($I)
604
            ->入力_姓($nameSei)
605
            ->入力_名($nameMei)
606
            ->入力_セイ('セイ')
607
            ->入力_メイ('メイ')
608
            ->入力_郵便番号('530-0001')
609
            ->入力_都道府県(['value' => '27'])
610
            ->入力_市区町村名('大阪市北区2')
611
            ->入力_番地_ビル名('梅田2-4-9 ブリーゼタワー13F2')
612
            ->入力_電話番号('222-222-222')
613
            ->登録する();
614
615
        // 新規お届け先が追加されていることを確認
616
        $I->see($nameSei, '#form_shipping_multiple_0_shipping_0_customer_address > option:nth-child(2)');
617
618
        // -------- EF0305-UC06-T01_複数配送 - 同じ商品種別(同一配送先) --------
619
        // 複数配送設定
620
        MultipleShippingPage::at($I)
621
            ->お届け先追加()
622
            ->入力_お届け先('0', '0', $customer->getName01())
623
            ->入力_お届け先('0', '1', $customer->getName01())
624
            ->入力_数量('0', '0', $shipping1_quantity)
625
            ->入力_数量('0', '1', $shipping2_quantity)
626
            ->選択したお届け先に送る()
627
        ;
628
629
        // 配送先が1個なので数量をまとめる
630
        $sum_quantity = $shipping1_quantity + $shipping2_quantity;
631
632
        // 複数配送設定がされておらず、個数が1明細にまとめられていることを確認
633
        $I->see('お届け先', '#shopping-form > div > div.ec-orderRole__detail > div.ec-orderDelivery > div:nth-child(2)');
634
        $I->dontSee('お届け先(1)', '#shopping-form > div > div.ec-orderRole__detail > div.ec-orderDelivery > div:nth-child(2)');
635
        $I->dontSee('お届け先(2)', '#shopping-form > div > div.ec-orderRole__detail > div.ec-orderDelivery > div:nth-child(6)');
636
        $I->see(' × '.$sum_quantity, '#shopping-form > div > div.ec-orderRole__detail > div.ec-orderDelivery > div:nth-child(3) > ul > li:nth-child(1) > div > div.ec-imageGrid__content > p:nth-child(2)');
637
        $I->see($customer->getName01(), '#shopping-form > div > div.ec-orderRole__detail > div.ec-orderDelivery > div:nth-child(4) > p:nth-child(1)');
638
639
        // -------- EF0305-UC06-T02_複数配送 - 同じ商品種別(別配送先) --------
640
641
        ShoppingPage::at($I)->お届け先追加();
642
643
        // 複数配送設定
644
        MultipleShippingPage::at($I)
645
            ->お届け先追加()
646
            ->入力_お届け先('0', '0', $customer->getName01())
647
            ->入力_お届け先('0', '1', $nameSei)
648
            ->入力_数量('0', '0', $shipping1_quantity)
649
            ->入力_数量('0', '1', $shipping2_quantity)
650
            ->選択したお届け先に送る()
651
        ;
652
653
        // 名前を比較してお届け先が上下どちらに表示されるか判断
654
        $compared = strnatcmp($customer->getName01(), $nameSei);
655
        if ($compared === 0) {
656
            $compared = strnatcmp($customer->getName02(), $nameMei);
657
        }
658
        // 上下それぞれで名前、商品個数を設定
659 View Code Duplication
        if ($compared < 0) {
660
            $quantity1 = $shipping1_quantity;
661
            $quantity2 = $shipping2_quantity;
662
            $name1 = $customer->getName01();
663
            $name2 = $nameSei;
664
        } else {
665
            $quantity1 = $shipping2_quantity;
666
            $quantity2 = $shipping1_quantity;
667
            $name1 = $nameSei;
668
            $name2 = $customer->getName01();
669
        }
670
671
        // 複数配送設定ができていることを確認
672
        $I->see('お届け先(1)', '#shopping-form > div > div.ec-orderRole__detail > div.ec-orderDelivery > div:nth-child(2)');
673
        $I->see(' × '.$quantity1, '#shopping-form > div > div.ec-orderRole__detail > div.ec-orderDelivery > div:nth-child(3) > ul > li:nth-child(1) > div > div.ec-imageGrid__content > p:nth-child(2)');
674
        $I->see($name1, '#shopping-form > div > div.ec-orderRole__detail > div.ec-orderDelivery > div:nth-child(4) > p:nth-child(1)');
675
        $I->see('お届け先(2)', '#shopping-form > div > div.ec-orderRole__detail > div.ec-orderDelivery > div:nth-child(6)');
676
        $I->see(' × '.$quantity2, '#shopping-form > div > div.ec-orderRole__detail > div.ec-orderDelivery > div:nth-child(7) > ul > li:nth-child(1) > div > div.ec-imageGrid__content > p:nth-child(2)');
677
        $I->see($name2, '#shopping-form > div > div.ec-orderRole__detail > div.ec-orderDelivery > div:nth-child(8) > p:nth-child(1)');
678
679
        // 一旦カートに戻る
680
        CartPage::go($I)
681
            ->レジに進む();
682
683
        // お届け先が復元されている
684
        $I->see('お届け先(1)', '#shopping-form > div > div.ec-orderRole__detail > div.ec-orderDelivery > div:nth-child(2)');
685
        $I->see(' × '.$quantity1, '#shopping-form > div > div.ec-orderRole__detail > div.ec-orderDelivery > div:nth-child(3) > ul > li:nth-child(1) > div > div.ec-imageGrid__content > p:nth-child(2)');
686
        $I->see($name1, '#shopping-form > div > div.ec-orderRole__detail > div.ec-orderDelivery > div:nth-child(4) > p:nth-child(1)');
687
        $I->see('お届け先(2)', '#shopping-form > div > div.ec-orderRole__detail > div.ec-orderDelivery > div:nth-child(6)');
688
        $I->see(' × '.$quantity2, '#shopping-form > div > div.ec-orderRole__detail > div.ec-orderDelivery > div:nth-child(7) > ul > li:nth-child(1) > div > div.ec-imageGrid__content > p:nth-child(2)');
689
        $I->see($name2, '#shopping-form > div > div.ec-orderRole__detail > div.ec-orderDelivery > div:nth-child(8) > p:nth-child(1)');
690
691
        ShoppingPage::at($I)->確認する();
692
        ShoppingConfirmPage::at($I)->注文する();
693
694
        $I->wait(1);
695
696
        // メール確認
697
        $I->seeEmailCount(2);
698 View Code Duplication
        foreach ([$customer->getEmail(), $BaseInfo->getEmail01()] as $email) {
699
            $I->seeInLastEmailSubjectTo($email, 'ご注文ありがとうございます');
700
            $I->seeInLastEmailTo($email, $customer->getName01().' '.$customer->getName02().' 様');
701
            $I->seeInLastEmailTo($email, 'お名前 :'.$customer->getName01().' '.$customer->getName02().' 様');
702
            $I->seeInLastEmailTo($email, 'お名前(フリガナ):'.$customer->getKana01().' '.$customer->getKana02().' 様');
703
            $I->seeInLastEmailTo($email, '郵便番号:〒'.$customer->getPostalCode());
704
            $I->seeInLastEmailTo($email, '住所  :'.$customer->getPref()->getName().$customer->getAddr01().$customer->getAddr02());
705
            $I->seeInLastEmailTo($email, '電話番号:'.$customer->getPhoneNumber());
706
            $I->seeInLastEmailTo($email, 'メールアドレス:'.$customer->getEmail());
707
            $I->seeInLastEmailTo($email, '◎お届け先1');
708
            $I->seeInLastEmailTo($email, 'お名前 :'.$nameSei);
709
            $I->seeInLastEmailTo($email, '数量:3');
710
            $I->seeInLastEmailTo($email, '◎お届け先2');
711
            $I->seeInLastEmailTo($email, '数量:2');
712
        }
713
714
        // 完了画面 -> topへ
715
        ShoppingCompletePage::at($I)->TOPへ();
716
        $I->see('新着情報', '.ec-news__title');
717
    }
718
719
    /**
0 ignored issues
show
introduced by
Doc comment for parameter "$I" missing
Loading history...
720
     * カートに変更があれば、お届け先の設定は初期化される.
721
     */
722
    public function order_購入確認画面からカートに戻るWithお届け先初期化(\AcceptanceTester $I)
0 ignored issues
show
Coding Style introduced by
Method name "EF03OrderCest::order_購入確認画面からカートに戻るWithお届け先初期化" is not in camel caps format
Loading history...
723
    {
724
        // チェック用変数
725
        // 追加するお届け作の名前
726
        $nameSei = '姓0302';
727
        $nameMei = '名0302';
728
        // カートへ入れる商品の数
729
        $cart_quantity = 1;
730
        // お届け先ごとに設定する商品の数
731
        $shipping1_quantity = 1;
732
        $shipping2_quantity = 2;
733
734
        $I->wantTo('EF0305-UC08-T02 購入確認画面からカートに戻る(お届け先初期化)');
735
        $I->logoutAsMember();
736
        $createCustomer = Fixtures::get('createCustomer');
737
        /** @var \Eccube\Entity\CustomerAddress $customer */
738
        $customer = $createCustomer();
739
        $BaseInfo = Fixtures::get('baseinfo');
740
741
        // 商品詳細パーコレータ カートへ
742
        ProductDetailPage::go($I, 2)
743
            ->カートに入れる($cart_quantity);
744
745
        $I->acceptPopup();
746
747
        CartPage::go($I)
748
            ->レジに進む();
749
750
        // ログイン
751
        ShoppingLoginPage::at($I)->ログイン($customer->getEmail());
752
753
        $I->resetEmails();
754
755
        // -------- EF0305-UC05-T01_お届け先の追加 --------
756
        ShoppingPage::at($I)->お届け先追加();
757
758
        // 新規お届け先追加
759
        MultipleShippingPage::at($I)->新規お届け先を追加する();
760
        CustomerAddressAddPage::at($I)
761
            ->入力_姓($nameSei)
762
            ->入力_名($nameMei)
763
            ->入力_セイ('セイ')
764
            ->入力_メイ('メイ')
765
            ->入力_郵便番号('530-0001')
766
            ->入力_都道府県(['value' => '27'])
767
            ->入力_市区町村名('大阪市北区2')
768
            ->入力_番地_ビル名('梅田2-4-9 ブリーゼタワー13F2')
769
            ->入力_電話番号('222-222-222')
770
            ->登録する();
771
772
        // 新規お届け先が追加されていることを確認
773
        $I->see($nameSei, '#form_shipping_multiple_0_shipping_0_customer_address > option:nth-child(2)');
774
775
        // -------- EF0305-UC06-T01_複数配送 - 同じ商品種別(同一配送先) --------
776
        // 複数配送設定
777
        MultipleShippingPage::at($I)
778
            ->お届け先追加()
779
            ->入力_お届け先('0', '0', $customer->getName01())
780
            ->入力_お届け先('0', '1', $customer->getName01())
781
            ->入力_数量('0', '0', $shipping1_quantity)
782
            ->入力_数量('0', '1', $shipping2_quantity)
783
            ->選択したお届け先に送る()
784
        ;
785
786
        // 配送先が1個なので数量をまとめる
787
        $sum_quantity = $shipping1_quantity + $shipping2_quantity;
788
789
        // 複数配送設定がされておらず、個数が1明細にまとめられていることを確認
790
        $I->see('お届け先', '#shopping-form > div > div.ec-orderRole__detail > div.ec-orderDelivery > div:nth-child(2)');
791
        $I->dontSee('お届け先(1)', '#shopping-form > div > div.ec-orderRole__detail > div.ec-orderDelivery > div:nth-child(2)');
792
        $I->dontSee('お届け先(2)', '#shopping-form > div > div.ec-orderRole__detail > div.ec-orderDelivery > div:nth-child(6)');
793
        $I->see(' × '.$sum_quantity, '#shopping-form > div > div.ec-orderRole__detail > div.ec-orderDelivery > div:nth-child(3) > ul > li:nth-child(1) > div > div.ec-imageGrid__content > p:nth-child(2)');
794
        $I->see($customer->getName01(), '#shopping-form > div > div.ec-orderRole__detail > div.ec-orderDelivery > div:nth-child(4) > p:nth-child(1)');
795
796
        // -------- EF0305-UC06-T02_複数配送 - 同じ商品種別(別配送先) --------
797
798
        ShoppingPage::at($I)->お届け先追加();
799
800
        // 複数配送設定
801
        MultipleShippingPage::at($I)
802
            ->お届け先追加()
803
            ->入力_お届け先('0', '0', $customer->getName01())
804
            ->入力_お届け先('0', '1', $nameSei)
805
            ->入力_数量('0', '0', $shipping1_quantity)
806
            ->入力_数量('0', '1', $shipping2_quantity)
807
            ->選択したお届け先に送る()
808
        ;
809
810
        // 名前を比較してお届け先が上下どちらに表示されるか判断
811
        $compared = strnatcmp($customer->getName01(), $nameSei);
812
        if ($compared === 0) {
813
            $compared = strnatcmp($customer->getName02(), $nameMei);
814
        }
815
        // 上下それぞれで名前、商品個数を設定
816 View Code Duplication
        if ($compared < 0) {
817
            $quantity1 = $shipping1_quantity;
818
            $quantity2 = $shipping2_quantity;
819
            $name1 = $customer->getName01();
820
            $name2 = $nameSei;
821
        } else {
822
            $quantity1 = $shipping2_quantity;
823
            $quantity2 = $shipping1_quantity;
824
            $name1 = $nameSei;
825
            $name2 = $customer->getName01();
826
        }
827
828
        // 複数配送設定ができていることを確認
829
        $I->see('お届け先(1)', '#shopping-form > div > div.ec-orderRole__detail > div.ec-orderDelivery > div:nth-child(2)');
830
        $I->see(' × '.$quantity1, '#shopping-form > div > div.ec-orderRole__detail > div.ec-orderDelivery > div:nth-child(3) > ul > li:nth-child(1) > div > div.ec-imageGrid__content > p:nth-child(2)');
831
        $I->see($name1, '#shopping-form > div > div.ec-orderRole__detail > div.ec-orderDelivery > div:nth-child(4) > p:nth-child(1)');
832
        $I->see('お届け先(2)', '#shopping-form > div > div.ec-orderRole__detail > div.ec-orderDelivery > div:nth-child(6)');
833
        $I->see(' × '.$quantity2, '#shopping-form > div > div.ec-orderRole__detail > div.ec-orderDelivery > div:nth-child(7) > ul > li:nth-child(1) > div > div.ec-imageGrid__content > p:nth-child(2)');
834
        $I->see($name2, '#shopping-form > div > div.ec-orderRole__detail > div.ec-orderDelivery > div:nth-child(8) > p:nth-child(1)');
835
836
        // 商品詳細パーコレータ カートへ
837
        ProductDetailPage::go($I, 2)
838
            ->カートに入れる($cart_quantity);
839
840
        $I->acceptPopup();
841
842
        // 一旦カートに戻る
843
        CartPage::go($I)
844
            ->レジに進む();
845
846
        // カートに変更があったため、お届け先を初期化
847
        $I->see('お届け先', '#shopping-form > div > div.ec-orderRole__detail > div.ec-orderDelivery > div:nth-child(2)');
848
        $I->dontSee('お届け先(1)', '#shopping-form > div > div.ec-orderRole__detail > div.ec-orderDelivery > div:nth-child(2)');
849
        $I->dontSee('お届け先(2)', '#shopping-form > div > div.ec-orderRole__detail > div.ec-orderDelivery > div:nth-child(6)');
850
        $I->see(' × '.($sum_quantity + $cart_quantity), '#shopping-form > div > div.ec-orderRole__detail > div.ec-orderDelivery > div:nth-child(3) > ul > li:nth-child(1) > div > div.ec-imageGrid__content > p:nth-child(2)');
851
        $I->see($customer->getName01(), '#shopping-form > div > div.ec-orderRole__detail > div.ec-orderDelivery > div:nth-child(4) > p:nth-child(1)');
852
853
        ShoppingPage::at($I)->確認する();
854
        ShoppingConfirmPage::at($I)->注文する();
855
856
        $I->wait(1);
857
858
        // メール確認
859
        $I->seeEmailCount(2);
860
        foreach ([$customer->getEmail(), $BaseInfo->getEmail01()] as $email) {
861
            $I->seeInLastEmailSubjectTo($email, 'ご注文ありがとうございます');
862
            $I->seeInLastEmailTo($email, $customer->getName01().' '.$customer->getName02().' 様');
863
            $I->seeInLastEmailTo($email, 'お名前 :'.$customer->getName01().' '.$customer->getName02().' 様');
864
            $I->seeInLastEmailTo($email, 'お名前(フリガナ):'.$customer->getKana01().' '.$customer->getKana02().' 様');
865
            $I->seeInLastEmailTo($email, '郵便番号:〒'.$customer->getPostalCode());
866
            $I->seeInLastEmailTo($email, '住所  :'.$customer->getPref()->getName().$customer->getAddr01().$customer->getAddr02());
867
            $I->seeInLastEmailTo($email, '電話番号:'.$customer->getPhoneNumber());
868
            $I->seeInLastEmailTo($email, 'メールアドレス:'.$customer->getEmail());
869
            $I->seeInLastEmailTo($email, '◎お届け先');
870
            $I->seeInLastEmailTo($email, 'お名前 :'.$customer->getName01());
871
            $I->seeInLastEmailTo($email, '数量:'.($sum_quantity + $cart_quantity));
872
        }
873
874
        // 完了画面 -> topへ
875
        ShoppingCompletePage::at($I)->TOPへ();
876
        $I->see('新着情報', '.ec-news__title');
877
    }
878
}
879