Completed
Pull Request — experimental/sf (#3265)
by Kiyotaka
104:10 queued 97:01
created

EF03OrderCest::order_複数配送設定画面での販売制限エラー()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 26

Duplication

Lines 0
Ratio 0 %

Importance

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