Completed
Push — fix-message-id-run-test ( be7b70...179b52 )
by Kiyotaka
06:49
created

EF03OrderCest   A

Complexity

Total Complexity 31

Size/Duplication

Total Lines 972
Duplicated Lines 15.84 %

Coupling/Cohesion

Components 1
Dependencies 14

Importance

Changes 0
Metric Value
dl 154
loc 972
rs 9.548
c 0
b 0
f 0
wmc 31
lcom 1
cbo 14

17 Methods

Rating   Name   Duplication   Size   Complexity  
A _before() 0 4 1
A _after() 0 3 1
A order_カート買い物を続ける() 18 18 1
A order_カート削除() 14 14 1
A order_カート数量増やす() 20 20 1
A order_カート数量減らす() 18 18 1
A order_ログインユーザ購入() 0 44 2
B order_ゲスト購入() 11 63 2
B order_ゲスト購入情報変更() 10 78 2
B order_ログインしてカートをマージ() 0 61 2
B order_ログインユーザ購入複数配送() 26 140 4
A order_ログイン後に複数カートになればカートに戻す() 0 50 2
B order_購入確認画面からカートに戻る() 26 152 4
B order_購入確認画面からカートに戻るWithお届け先初期化() 11 154 4
A order_複数配送設定画面での販売制限エラー() 0 26 1
A order_複数ブラウザでログインしてカートに追加する() 0 40 1
B order_複数ブラウザ_片方でログインしてカートに追加しもう一方にログインして別の商品を追加する() 0 58 1

How to fix   Duplicated Code   

Duplicated Code

Duplicate code is one of the most pungent code smells. A rule that is often used is to re-structure code once it is duplicated in three or more places.

Common duplication problems, and corresponding solutions are:

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 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...
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
43
        CartPage::go($I)
44
            ->お買い物を続ける();
45
46
        // トップページ
47
        $I->see('新着情報', '.ec-news__title');
48
    }
49
50 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...
51
    {
52
        $I->wantTo('EF0301-UC01-T02 カート 削除');
53
        $createCustomer = Fixtures::get('createCustomer');
54
        $customer = $createCustomer();
55
        $I->loginAsMember($customer->getEmail(), 'password');
56
57
        ProductDetailPage::go($I, 2)
58
            ->カートに入れる(1)
59
            ->カートへ進む();
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...
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
78
        $cartPage = CartPage::go($I)
79
            ->商品数量増やす(1);
80
81
        // 確認
82
        $I->assertEquals('2', $cartPage->商品数量(1));
83
84
    }
85
86 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...
87
    {
88
        $I->wantTo('EF0301-UC01-T04 カート 数量減らす');
89
        $createCustomer = Fixtures::get('createCustomer');
90
        $customer = $createCustomer();
91
        $I->loginAsMember($customer->getEmail(), 'password');
92
93
        // 商品詳細パーコレータ カートへ
94
        ProductDetailPage::go($I, 2)
95
            ->カートに入れる(2)
96
            ->カートへ進む();
97
98
        $cartPage = CartPage::go($I)
99
            ->商品数量減らす(1);
100
101
        // 確認
102
        $I->assertEquals('1', $cartPage->商品数量(1));
103
    }
104
105
    public function order_ログインユーザ購入(\AcceptanceTester $I)
106
    {
107
        $I->wantTo('EF0302-UC01-T01 ログインユーザ購入');
108
        $I->logoutAsMember();
109
        $createCustomer = Fixtures::get('createCustomer');
110
        $customer = $createCustomer();
111
        $BaseInfo = Fixtures::get('baseinfo');
112
113
        // 商品詳細パーコレータ カートへ
114
        ProductDetailPage::go($I, 2)
115
            ->カートに入れる(1)
116
            ->カートへ進む();
117
118
        CartPage::go($I)
119
            ->レジに進む();
120
121
        // ログイン
122
        ShoppingLoginPage::at($I)->ログイン($customer->getEmail());
123
124
        $I->resetEmails();
125
126
        ShoppingPage::at($I)->確認する();
127
        ShoppingConfirmPage::at($I)->注文する();
128
129
        $I->wait(1);
130
131
        // メール確認
132
        $I->seeEmailCount(2);
133
        foreach (array($customer->getEmail(), $BaseInfo->getEmail01()) as $email) {
134
            // TODO 注文した商品の内容もチェックしたい
135
            $I->seeInLastEmailSubjectTo($email, 'ご注文ありがとうございます');
136
            $I->seeInLastEmailTo($email, $customer->getName01().' '.$customer->getName02().' 様');
137
            $I->seeInLastEmailTo($email, 'お名前 :'.$customer->getName01().' '.$customer->getName02().' 様');
138
            $I->seeInLastEmailTo($email, 'お名前(フリガナ):'.$customer->getKana01().' '.$customer->getKana02().' 様');
139
            $I->seeInLastEmailTo($email, '郵便番号:〒'.$customer->getPostalCode());
140
            $I->seeInLastEmailTo($email, '住所  :'.$customer->getPref()->getName().$customer->getAddr01().$customer->getAddr02());
141
            $I->seeInLastEmailTo($email, '電話番号:'.$customer->getPhoneNumber());
142
            $I->seeInLastEmailTo($email, 'メールアドレス:'.$customer->getEmail());
143
        }
144
145
        // 完了画面 -> topへ
146
        ShoppingCompletePage::at($I)->TOPへ();
147
        $I->see('新着情報', '.ec-news__title');
148
    }
149
150
    public function order_ゲスト購入(\AcceptanceTester $I)
151
    {
152
        $I->wantTo('EF0302-UC02-T01 ゲスト購入');
153
        $I->logoutAsMember();
154
155
        $faker = Fixtures::get('faker');
156
        $new_email = microtime(true).'.'.$faker->safeEmail;
157
        $BaseInfo = Fixtures::get('baseinfo');
158
159
        ProductDetailPage::go($I, 2)
160
            ->カートに入れる(1)
161
            ->カートへ進む();
162
163
        CartPage::go($I)
164
            ->レジに進む();
165
166
        $ShoppingPage = ShoppingLoginPage::at($I)->ゲスト購入();
167
        $ShoppingPage
168
            ->入力_姓('姓03')
169
            ->入力_名('名03')
170
            ->入力_セイ('セイ')
171
            ->入力_メイ('メイ')
172
            ->入力_郵便番号('530-0001');
173
174
        // TODO: 郵便番号入力後のcodeceptionの入力後にJSが走ってしまい「梅田」が2重で入力されてしまう。
175
        // 上記を回避するためにwait関数を入れる。
176
        // こちらは本体のmasterブランチで修正されているので、master -> sf マージ後には不要になる見込み。
177
        $I->wait(5);
178
179
        $ShoppingPage
180
            ->入力_都道府県(['value' => '27'])
181
            ->入力_市区町村名('大阪市北区')
182
            ->入力_番地_ビル名('梅田2-4-9 ブリーゼタワー13F')
183
            ->入力_電話番号('111-111-111')
184
            ->入力_Eメール($new_email)
185
            ->入力_Eメール確認($new_email)
186
            ->次へ();
187
188
        $I->resetEmails();
189
190
        ShoppingPage::at($I)->確認する();
191
        ShoppingConfirmPage::at($I)->注文する();
192
193
        $I->wait(1);
194
195
        // 確認
196
        $I->seeEmailCount(2);
197 View Code Duplication
        foreach ([$new_email, $BaseInfo->getEmail01()] as $email) {
0 ignored issues
show
Duplication introduced by
This code seems to be duplicated across 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...
198
            // TODO 注文した商品の内容もチェックしたい
199
            $I->seeInLastEmailSubjectTo($email, 'ご注文ありがとうございます');
200
            $I->seeInLastEmailTo($email, '姓03 名03 様');
201
            $I->seeInLastEmailTo($email, 'お名前 :姓03 名03 様');
202
            $I->seeInLastEmailTo($email, 'お名前(フリガナ):セイ メイ 様');
203
            $I->seeInLastEmailTo($email, '郵便番号:〒5300001');
204
            $I->seeInLastEmailTo($email, '住所  :大阪府大阪市北区梅田2-4-9 ブリーゼタワー13F');
205
            $I->seeInLastEmailTo($email, '電話番号:111111111');
206
            $I->seeInLastEmailTo($email, 'メールアドレス:'.$new_email);
207
        }
208
209
        // 完了画面 -> topへ
210
        ShoppingCompletePage::at($I)->TOPへ();
211
        $I->see('新着情報', '.ec-news__title');
212
    }
213
214
    public function order_ゲスト購入情報変更(\AcceptanceTester $I)
215
    {
216
        $I->wantTo('EF0305-UC02-T01 ゲスト購入 情報変更'); // EF0305-UC04-T01も一緒にテスト
217
        $I->logoutAsMember();
218
219
        $faker = Fixtures::get('faker');
220
        $new_email = microtime(true).'.'.$faker->safeEmail;
221
        $BaseInfo = Fixtures::get('baseinfo');
222
223
        // 商品詳細パーコレータ カートへ
224
        ProductDetailPage::go($I, 2)
225
            ->カートに入れる(1)
226
            ->カートへ進む();
227
228
        CartPage::go($I)
229
            ->レジに進む();
230
231
        $ShoppingPage = ShoppingLoginPage::at($I)->ゲスト購入();
232
        $ShoppingPage
233
            ->入力_姓('姓03')
234
            ->入力_名('名03')
235
            ->入力_セイ('セイ')
236
            ->入力_メイ('メイ')
237
            ->入力_郵便番号('530-0001');
238
239
        // TODO: 郵便番号入力後のcodeceptionの入力後にJSが走ってしまい「梅田」が2重で入力されてしまう。
240
        // 上記を回避するためにwait関数を入れる。
241
        // こちらは本体のmasterブランチで修正されているので、master -> sf マージ後には不要になる見込み。
242
        $I->wait(5);
243
244
        $ShoppingPage
245
            ->入力_都道府県(['value' => '27'])
246
            ->入力_市区町村名('大阪市北区')
247
            ->入力_番地_ビル名('梅田2-4-9 ブリーゼタワー13F')
248
            ->入力_電話番号('111-111-111')
249
            ->入力_Eメール($new_email)
250
            ->入力_Eメール確認($new_email)
251
            ->次へ();
252
253
        // 確認
254
        $ShoppingPage = ShoppingPage::at($I)
255
            ->お客様情報変更()
256
            ->入力_姓('姓0301')
257
            ->お客様情報変更OK();
258
259
        // 確認
260
        $I->see('姓0301', '#shopping-form .customer-name01');
261
262
        // 配送情報
263
        $ShoppingPage->お届け先変更();
264
265
        ShippingEditPage::at($I)
266
            ->入力_姓('姓0302')
267
            ->登録する();
268
269
        $I->see('姓0302', 'div.ec-orderRole div.ec-orderDelivery__address');
270
271
        $I->resetEmails();
272
273
        ShoppingPage::at($I)->確認する();
274
        ShoppingConfirmPage::at($I)->注文する();
275
276
        $I->seeEmailCount(2);
277 View Code Duplication
        foreach ([$new_email, $BaseInfo->getEmail01()] as $email) {
0 ignored issues
show
Duplication introduced by
This code seems to be duplicated across 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...
278
            // TODO 注文した商品の内容もチェックしたい
279
            $I->seeInLastEmailSubjectTo($email, 'ご注文ありがとうございます');
280
            $I->seeInLastEmailTo($email, '姓0301 名03 様');
281
            $I->seeInLastEmailTo($email, 'お名前 :姓0302 名03 様', '変更後のお届け先');
282
            $I->seeInLastEmailTo($email, '郵便番号:〒5300001');
283
            $I->seeInLastEmailTo($email, '住所  :大阪府大阪市北区梅田2-4-9 ブリーゼタワー13F');
284
            $I->seeInLastEmailTo($email, '電話番号:111111111');
285
            $I->seeInLastEmailTo($email, 'メールアドレス:'.$new_email);
286
        }
287
288
        // topへ
289
        ShoppingCompletePage::at($I)->TOPへ();
290
        $I->see('新着情報', '.ec-news__title');
291
    }
292
293
    /**
294
     * @see https://github.com/EC-CUBE/ec-cube/pull/3133
295
     */
296
    public function order_ログインしてカートをマージ(\AcceptanceTester $I)
297
    {
298
        $I->wantTo('EF0305-UC07-T01 ログインしてカートをマージ');
299
        $I->logoutAsMember();
300
        $createCustomer = Fixtures::get('createCustomer');
301
        $customer = $createCustomer();
302
        $BaseInfo = Fixtures::get('baseinfo');
303
304
        // 商品詳細パーコレータ カートへ
305
        ProductDetailPage::go($I, 2)
306
            ->カートに入れる(1)
307
            ->カートへ進む();
308
309
        CartPage::go($I)
310
            ->レジに進む();
311
312
        // ログイン
313
        ShoppingLoginPage::at($I)->ログイン($customer->getEmail());
314
315
        $I->resetEmails();
316
317
        ShoppingPage::at($I)->確認する();
318
        $I->logoutAsMember();
319
320
        // 商品詳細フォーク カートへ
321
        ProductDetailPage::go($I, 1)
322
            ->規格選択(['プラチナ', '150cm'])
323
            ->カートに入れる(1)
324
            ->カートへ進む();
325
326
        CartPage::go($I)
327
            ->レジに進む();
328
329
        // ログイン
330
        ShoppingLoginPage::at($I)->ログイン($customer->getEmail());
331
332
        ShoppingPage::at($I)->確認する();
333
        ShoppingConfirmPage::at($I)->注文する();
334
335
        $I->wait(1);
336
337
        // メール確認
338
        $I->seeEmailCount(2);
339
        foreach ([$customer->getEmail(), $BaseInfo->getEmail01()] as $email) {
340
            $I->seeInLastEmailSubjectTo($email, 'ご注文ありがとうございます');
341
            $I->seeInLastEmailTo($email, $customer->getName01().' '.$customer->getName02().' 様');
342
            $I->seeInLastEmailTo($email, 'お名前 :'.$customer->getName01().' '.$customer->getName02().' 様');
343
            $I->seeInLastEmailTo($email, 'お名前(フリガナ):'.$customer->getKana01().' '.$customer->getKana02().' 様');
344
            $I->seeInLastEmailTo($email, '郵便番号:〒'.$customer->getPostalCode());
345
            $I->seeInLastEmailTo($email, '住所  :'.$customer->getPref()->getName().$customer->getAddr01().$customer->getAddr02());
346
            $I->seeInLastEmailTo($email, '電話番号:'.$customer->getPhoneNumber());
347
            $I->seeInLastEmailTo($email, 'メールアドレス:'.$customer->getEmail());
348
349
            $I->seeInLastEmailTo($email, '商品名: パーコレーター');
350
            $I->seeInLastEmailTo($email, '商品名: ディナーフォーク  プラチナ  150cm');
351
        }
352
353
        // 完了画面 -> topへ
354
        ShoppingCompletePage::at($I)->TOPへ();
355
        $I->see('新着情報', '.ec-news__title');
356
    }
357
358
    public function order_ログインユーザ購入複数配送(\AcceptanceTester $I)
359
    {
360
        // チェック用変数
361
        // 追加するお届け作の名前
362
        $nameSei = '姓0302';
363
        $nameMei = '名0302';
364
        // カートへ入れる商品の数
365
        $cart_quantity = 1;
366
        // お届け先ごとに設定する商品の数
367
        $shipping1_quantity = 2;
368
        $shipping2_quantity = 3;
369
370
        $I->wantTo('EF0305-UC05-T01 お届け先の追加');
371
        $I->logoutAsMember();
372
        $createCustomer = Fixtures::get('createCustomer');
373
        /** @var \Eccube\Entity\CustomerAddress $customer */
374
        $customer = $createCustomer();
375
        $BaseInfo = Fixtures::get('baseinfo');
376
377
        // 商品詳細パーコレータ カートへ
378
        ProductDetailPage::go($I, 2)
379
            ->カートに入れる($cart_quantity)
380
            ->カートへ進む();
381
382
        CartPage::go($I)
383
            ->レジに進む();
384
385
        // ログイン
386
        ShoppingLoginPage::at($I)->ログイン($customer->getEmail());
0 ignored issues
show
Bug introduced by
The method getEmail() does not seem to exist on object<Eccube\Entity\CustomerAddress>.

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
387
388
        $I->resetEmails();
389
390
        // -------- EF0305-UC05-T01_お届け先の追加 --------
391
        ShoppingPage::at($I)->お届け先追加();
392
393
        // 新規お届け先追加
394
        MultipleShippingPage::at($I)->新規お届け先を追加する();
395
        CustomerAddressAddPage::at($I)
396
            ->入力_姓($nameSei)
397
            ->入力_名($nameMei)
398
            ->入力_セイ('セイ')
399
            ->入力_メイ('メイ')
400
            ->入力_郵便番号('530-0001')
401
            ->入力_都道府県(['value' => '27'])
402
            ->入力_市区町村名('大阪市北区2')
403
            ->入力_番地_ビル名('梅田2-4-9 ブリーゼタワー13F2')
404
            ->入力_電話番号('222-222-222')
405
            ->登録する();
406
407
        // 新規お届け先が追加されていることを確認
408
        $I->see($nameSei, '#form_shipping_multiple_0_shipping_0_customer_address > option:nth-child(2)');
409
410
        // -------- EF0305-UC06-T01_複数配送 - 同じ商品種別(同一配送先) --------
411
        // 複数配送設定
412
        MultipleShippingPage::at($I)
413
            ->お届け先追加()
414
            ->入力_お届け先('0', '0', $customer->getName01())
415
            ->入力_お届け先('0', '1', $customer->getName01())
416
            ->入力_数量('0', '0', $shipping1_quantity)
417
            ->入力_数量('0', '1', $shipping2_quantity)
418
            ->選択したお届け先に送る()
419
        ;
420
421
        // 配送先が1個なので数量をまとめる
422
        $sum_quantity = $shipping1_quantity + $shipping2_quantity;
423
424
        // 複数配送設定がされておらず、個数が1明細にまとめられていることを確認
425
        $I->see('お届け先', '#shopping-form > div > div.ec-orderRole__detail > div.ec-orderDelivery > div:nth-child(2)');
426
        $I->dontSee('お届け先(1)', '#shopping-form > div > div.ec-orderRole__detail > div.ec-orderDelivery > div:nth-child(2)');
427
        $I->dontSee('お届け先(2)', '#shopping-form > div > div.ec-orderRole__detail > div.ec-orderDelivery > div:nth-child(6)');
428
        $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)');
429
        $I->see($customer->getName01(), '#shopping-form > div > div.ec-orderRole__detail > div.ec-orderDelivery > div:nth-child(4) > p:nth-child(1)');
430
431
        // -------- EF0305-UC06-T02_複数配送 - 同じ商品種別(別配送先) --------
432
433
        ShoppingPage::at($I)->お届け先追加();
434
435
        // 複数配送設定
436
        MultipleShippingPage::at($I)
437
            ->お届け先追加()
438
            ->入力_お届け先('0', '0', $customer->getName01())
439
            ->入力_お届け先('0', '1', $nameSei)
440
            ->入力_数量('0', '0', $shipping1_quantity)
441
            ->入力_数量('0', '1', $shipping2_quantity)
442
            ->選択したお届け先に送る()
443
        ;
444
445
        // 名前を比較してお届け先が上下どちらに表示されるか判断
446
        $compared = strnatcmp($customer->getName01(), $nameSei);
447
        if ($compared === 0) {
448
            $compared = strnatcmp($customer->getName02(), $nameMei);
449
        }
450
        // 上下それぞれで名前、商品個数を設定
451 View Code Duplication
        if ($compared < 0) {
0 ignored issues
show
Duplication introduced by
This code seems to be duplicated across 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...
452
            $quantity1 = $shipping1_quantity;
453
            $quantity2 = $shipping2_quantity;
454
            $name1 = $customer->getName01();
455
            $name2 = $nameSei;
456
        } else {
457
            $quantity1 = $shipping2_quantity;
458
            $quantity2 = $shipping1_quantity;
459
            $name1 = $nameSei;
460
            $name2 = $customer->getName01();
461
        }
462
463
        // 複数配送設定ができていることを確認
464
        $I->see('お届け先(1)', '#shopping-form > div > div.ec-orderRole__detail > div.ec-orderDelivery > div:nth-child(2)');
465
        $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)');
466
        $I->see($name1, '#shopping-form > div > div.ec-orderRole__detail > div.ec-orderDelivery > div:nth-child(4) > p:nth-child(1)');
467
        $I->see('お届け先(2)', '#shopping-form > div > div.ec-orderRole__detail > div.ec-orderDelivery > div:nth-child(6)');
468
        $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)');
469
        $I->see($name2, '#shopping-form > div > div.ec-orderRole__detail > div.ec-orderDelivery > div:nth-child(8) > p:nth-child(1)');
470
471
        ShoppingPage::at($I)->確認する();
472
        ShoppingConfirmPage::at($I)->注文する();
473
474
        $I->wait(1);
475
476
        // メール確認
477
        $I->seeEmailCount(2);
478 View Code Duplication
        foreach ([$customer->getEmail(), $BaseInfo->getEmail01()] as $email) {
0 ignored issues
show
Bug introduced by
The method getEmail() does not seem to exist on object<Eccube\Entity\CustomerAddress>.

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
Duplication introduced by
This code seems to be duplicated across 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...
479
            $I->seeInLastEmailSubjectTo($email, 'ご注文ありがとうございます');
480
            $I->seeInLastEmailTo($email, $customer->getName01().' '.$customer->getName02().' 様');
481
            $I->seeInLastEmailTo($email, 'お名前 :'.$customer->getName01().' '.$customer->getName02().' 様');
482
            $I->seeInLastEmailTo($email, 'お名前(フリガナ):'.$customer->getKana01().' '.$customer->getKana02().' 様');
483
            $I->seeInLastEmailTo($email, '郵便番号:〒'.$customer->getPostalCode());
484
            $I->seeInLastEmailTo($email, '住所  :'.$customer->getPref()->getName().$customer->getAddr01().$customer->getAddr02());
485
            $I->seeInLastEmailTo($email, '電話番号:'.$customer->getPhoneNumber());
486
            $I->seeInLastEmailTo($email, 'メールアドレス:'.$customer->getEmail());
0 ignored issues
show
Bug introduced by
The method getEmail() does not seem to exist on object<Eccube\Entity\CustomerAddress>.

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
487
            $I->seeInLastEmailTo($email, '◎お届け先1');
488
            $I->seeInLastEmailTo($email, 'お名前 :'.$nameSei);
489
            $I->seeInLastEmailTo($email, '数量:3');
490
            $I->seeInLastEmailTo($email, '◎お届け先2');
491
            $I->seeInLastEmailTo($email, '数量:2');
492
        }
493
494
        // 完了画面 -> topへ
495
        ShoppingCompletePage::at($I)->TOPへ();
496
        $I->see('新着情報', '.ec-news__title');
497
    }
498
499
    public function order_ログイン後に複数カートになればカートに戻す(\AcceptanceTester $I)
500
    {
501
        $I->wantTo('EF0303-UC01-T01_購入フローでログインしたタイミングで複数カートになったらログイン後にカート画面に戻す');
502
        $I->logoutAsMember();
503
        $createCustomer = Fixtures::get('createCustomer');
504
        $customer = $createCustomer();
505
        $I->loginAsMember($customer->getEmail(), 'password');
506
507
        // 商品詳細パーコレータ カートへ
508
        ProductDetailPage::go($I, 2)
509
            ->カートに入れる(1)
510
            ->カートへ進む();
511
512
        CartPage::go($I)
513
            ->レジに進む();
514
515
        // ログアウト
516
        $I->logoutAsMember();
517
518
        $createProduct = Fixtures::get('createProduct');
519
        $Product = $createProduct();
520
521
        $entityManager = Fixtures::get('entityManager');
522
        $ProductClass = $Product->getProductClasses()[0];
523
        $SaleType = $entityManager->find(\Eccube\Entity\Master\SaleType::class, 2);
524
        $ProductClass->setSaleType($SaleType);
525
        $entityManager->persist($ProductClass);
526
        $entityManager->flush();
527
528
        if ($ProductClass->getClassCategory2()) {
529
            // 商品詳細
530
            ProductDetailPage::go($I, $Product->getId())
531
                ->規格選択([$ProductClass->getClassCategory1(), $ProductClass->getClassCategory2()])
532
                ->カートに入れる(1)
533
                ->カートへ進む();
534
        } else {
535
            ProductDetailPage::go($I, $Product->getId())
536
                ->規格選択([$ProductClass->getClassCategory1()])
537
                ->カートに入れる(1)
538
                ->カートへ進む();
539
        }
540
541
        CartPage::go($I)
542
            ->レジに進む();
543
544
        // ログイン
545
        ShoppingLoginPage::at($I)->ログイン($customer->getEmail());
546
547
        $I->see('同時購入できない商品がカートに含まれています', '.ec-alert-warning__text');
548
    }
549
550
    /**
551
     * カートに変更が無ければ、お届け先の設定が引き継がれる.
552
     */
553
    public function order_購入確認画面からカートに戻る(\AcceptanceTester $I)
554
    {
555
        // チェック用変数
556
        // 追加するお届け作の名前
557
        $nameSei = '姓0302';
558
        $nameMei = '名0302';
559
        // カートへ入れる商品の数
560
        $cart_quantity = 1;
561
        // お届け先ごとに設定する商品の数
562
        $shipping1_quantity = 2;
563
        $shipping2_quantity = 3;
564
565
        $I->wantTo('EF0305-UC08-T01 購入確認画面からカートに戻る');
566
        $I->logoutAsMember();
567
        $createCustomer = Fixtures::get('createCustomer');
568
        /** @var \Eccube\Entity\CustomerAddress $customer */
569
        $customer = $createCustomer();
570
        $BaseInfo = Fixtures::get('baseinfo');
571
572
        // 商品詳細パーコレータ カートへ
573
        ProductDetailPage::go($I, 2)
574
            ->カートに入れる($cart_quantity)
575
            ->カートへ進む();
576
577
        CartPage::go($I)
578
            ->レジに進む();
579
580
        // ログイン
581
        ShoppingLoginPage::at($I)->ログイン($customer->getEmail());
0 ignored issues
show
Bug introduced by
The method getEmail() does not seem to exist on object<Eccube\Entity\CustomerAddress>.

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
582
583
        $I->resetEmails();
584
585
        // -------- EF0305-UC05-T01_お届け先の追加 --------
586
        ShoppingPage::at($I)->お届け先追加();
587
588
        // 新規お届け先追加
589
        MultipleShippingPage::at($I)->新規お届け先を追加する();
590
        CustomerAddressAddPage::at($I)
591
            ->入力_姓($nameSei)
592
            ->入力_名($nameMei)
593
            ->入力_セイ('セイ')
594
            ->入力_メイ('メイ')
595
            ->入力_郵便番号('530-0001')
596
            ->入力_都道府県(['value' => '27'])
597
            ->入力_市区町村名('大阪市北区2')
598
            ->入力_番地_ビル名('梅田2-4-9 ブリーゼタワー13F2')
599
            ->入力_電話番号('222-222-222')
600
            ->登録する();
601
602
        // 新規お届け先が追加されていることを確認
603
        $I->see($nameSei, '#form_shipping_multiple_0_shipping_0_customer_address > option:nth-child(2)');
604
605
        // -------- EF0305-UC06-T01_複数配送 - 同じ商品種別(同一配送先) --------
606
        // 複数配送設定
607
        MultipleShippingPage::at($I)
608
            ->お届け先追加()
609
            ->入力_お届け先('0', '0', $customer->getName01())
610
            ->入力_お届け先('0', '1', $customer->getName01())
611
            ->入力_数量('0', '0', $shipping1_quantity)
612
            ->入力_数量('0', '1', $shipping2_quantity)
613
            ->選択したお届け先に送る()
614
        ;
615
616
        // 配送先が1個なので数量をまとめる
617
        $sum_quantity = $shipping1_quantity + $shipping2_quantity;
618
619
        // 複数配送設定がされておらず、個数が1明細にまとめられていることを確認
620
        $I->see('お届け先', '#shopping-form > div > div.ec-orderRole__detail > div.ec-orderDelivery > div:nth-child(2)');
621
        $I->dontSee('お届け先(1)', '#shopping-form > div > div.ec-orderRole__detail > div.ec-orderDelivery > div:nth-child(2)');
622
        $I->dontSee('お届け先(2)', '#shopping-form > div > div.ec-orderRole__detail > div.ec-orderDelivery > div:nth-child(6)');
623
        $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)');
624
        $I->see($customer->getName01(), '#shopping-form > div > div.ec-orderRole__detail > div.ec-orderDelivery > div:nth-child(4) > p:nth-child(1)');
625
626
        // -------- EF0305-UC06-T02_複数配送 - 同じ商品種別(別配送先) --------
627
628
        ShoppingPage::at($I)->お届け先追加();
629
630
        // 複数配送設定
631
        MultipleShippingPage::at($I)
632
            ->お届け先追加()
633
            ->入力_お届け先('0', '0', $customer->getName01())
634
            ->入力_お届け先('0', '1', $nameSei)
635
            ->入力_数量('0', '0', $shipping1_quantity)
636
            ->入力_数量('0', '1', $shipping2_quantity)
637
            ->選択したお届け先に送る()
638
        ;
639
640
        // 名前を比較してお届け先が上下どちらに表示されるか判断
641
        $compared = strnatcmp($customer->getName01(), $nameSei);
642
        if ($compared === 0) {
643
            $compared = strnatcmp($customer->getName02(), $nameMei);
644
        }
645
        // 上下それぞれで名前、商品個数を設定
646 View Code Duplication
        if ($compared < 0) {
0 ignored issues
show
Duplication introduced by
This code seems to be duplicated across 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...
647
            $quantity1 = $shipping1_quantity;
648
            $quantity2 = $shipping2_quantity;
649
            $name1 = $customer->getName01();
650
            $name2 = $nameSei;
651
        } else {
652
            $quantity1 = $shipping2_quantity;
653
            $quantity2 = $shipping1_quantity;
654
            $name1 = $nameSei;
655
            $name2 = $customer->getName01();
656
        }
657
658
        // 複数配送設定ができていることを確認
659
        $I->see('お届け先(1)', '#shopping-form > div > div.ec-orderRole__detail > div.ec-orderDelivery > div:nth-child(2)');
660
        $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)');
661
        $I->see($name1, '#shopping-form > div > div.ec-orderRole__detail > div.ec-orderDelivery > div:nth-child(4) > p:nth-child(1)');
662
        $I->see('お届け先(2)', '#shopping-form > div > div.ec-orderRole__detail > div.ec-orderDelivery > div:nth-child(6)');
663
        $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)');
664
        $I->see($name2, '#shopping-form > div > div.ec-orderRole__detail > div.ec-orderDelivery > div:nth-child(8) > p:nth-child(1)');
665
666
        // 一旦カートに戻る
667
        CartPage::go($I)
668
            ->レジに進む();
669
670
        // お届け先が復元されている
671
        $I->see('お届け先(1)', '#shopping-form > div > div.ec-orderRole__detail > div.ec-orderDelivery > div:nth-child(2)');
672
        $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)');
673
        $I->see($name1, '#shopping-form > div > div.ec-orderRole__detail > div.ec-orderDelivery > div:nth-child(4) > p:nth-child(1)');
674
        $I->see('お届け先(2)', '#shopping-form > div > div.ec-orderRole__detail > div.ec-orderDelivery > div:nth-child(6)');
675
        $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)');
676
        $I->see($name2, '#shopping-form > div > div.ec-orderRole__detail > div.ec-orderDelivery > div:nth-child(8) > p:nth-child(1)');
677
678
        ShoppingPage::at($I)->確認する();
679
        ShoppingConfirmPage::at($I)->注文する();
680
681
        $I->wait(1);
682
683
        // メール確認
684
        $I->seeEmailCount(2);
685 View Code Duplication
        foreach ([$customer->getEmail(), $BaseInfo->getEmail01()] as $email) {
0 ignored issues
show
Bug introduced by
The method getEmail() does not seem to exist on object<Eccube\Entity\CustomerAddress>.

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
Duplication introduced by
This code seems to be duplicated across 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...
686
            $I->seeInLastEmailSubjectTo($email, 'ご注文ありがとうございます');
687
            $I->seeInLastEmailTo($email, $customer->getName01().' '.$customer->getName02().' 様');
688
            $I->seeInLastEmailTo($email, 'お名前 :'.$customer->getName01().' '.$customer->getName02().' 様');
689
            $I->seeInLastEmailTo($email, 'お名前(フリガナ):'.$customer->getKana01().' '.$customer->getKana02().' 様');
690
            $I->seeInLastEmailTo($email, '郵便番号:〒'.$customer->getPostalCode());
691
            $I->seeInLastEmailTo($email, '住所  :'.$customer->getPref()->getName().$customer->getAddr01().$customer->getAddr02());
692
            $I->seeInLastEmailTo($email, '電話番号:'.$customer->getPhoneNumber());
693
            $I->seeInLastEmailTo($email, 'メールアドレス:'.$customer->getEmail());
0 ignored issues
show
Bug introduced by
The method getEmail() does not seem to exist on object<Eccube\Entity\CustomerAddress>.

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
694
            $I->seeInLastEmailTo($email, '◎お届け先1');
695
            $I->seeInLastEmailTo($email, 'お名前 :'.$nameSei);
696
            $I->seeInLastEmailTo($email, '数量:3');
697
            $I->seeInLastEmailTo($email, '◎お届け先2');
698
            $I->seeInLastEmailTo($email, '数量:2');
699
        }
700
701
        // 完了画面 -> topへ
702
        ShoppingCompletePage::at($I)->TOPへ();
703
        $I->see('新着情報', '.ec-news__title');
704
    }
705
706
    /**
707
     * カートに変更があれば、お届け先の設定は初期化される.
708
     */
709
    public function order_購入確認画面からカートに戻るWithお届け先初期化(\AcceptanceTester $I)
710
    {
711
        // チェック用変数
712
        // 追加するお届け作の名前
713
        $nameSei = '姓0302';
714
        $nameMei = '名0302';
715
        // カートへ入れる商品の数
716
        $cart_quantity = 1;
717
        // お届け先ごとに設定する商品の数
718
        $shipping1_quantity = 1;
719
        $shipping2_quantity = 2;
720
721
        $I->wantTo('EF0305-UC08-T02 購入確認画面からカートに戻る(お届け先初期化)');
722
        $I->logoutAsMember();
723
        $createCustomer = Fixtures::get('createCustomer');
724
        /** @var \Eccube\Entity\CustomerAddress $customer */
725
        $customer = $createCustomer();
726
        $BaseInfo = Fixtures::get('baseinfo');
727
728
        // 商品詳細パーコレータ カートへ
729
        ProductDetailPage::go($I, 2)
730
            ->カートに入れる($cart_quantity)
731
            ->カートへ進む();
732
733
        CartPage::go($I)
734
            ->レジに進む();
735
736
        // ログイン
737
        ShoppingLoginPage::at($I)->ログイン($customer->getEmail());
0 ignored issues
show
Bug introduced by
The method getEmail() does not seem to exist on object<Eccube\Entity\CustomerAddress>.

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
738
739
        $I->resetEmails();
740
741
        // -------- EF0305-UC05-T01_お届け先の追加 --------
742
        ShoppingPage::at($I)->お届け先追加();
743
744
        // 新規お届け先追加
745
        MultipleShippingPage::at($I)->新規お届け先を追加する();
746
        CustomerAddressAddPage::at($I)
747
            ->入力_姓($nameSei)
748
            ->入力_名($nameMei)
749
            ->入力_セイ('セイ')
750
            ->入力_メイ('メイ')
751
            ->入力_郵便番号('530-0001')
752
            ->入力_都道府県(['value' => '27'])
753
            ->入力_市区町村名('大阪市北区2')
754
            ->入力_番地_ビル名('梅田2-4-9 ブリーゼタワー13F2')
755
            ->入力_電話番号('222-222-222')
756
            ->登録する();
757
758
        // 新規お届け先が追加されていることを確認
759
        $I->see($nameSei, '#form_shipping_multiple_0_shipping_0_customer_address > option:nth-child(2)');
760
761
        // -------- EF0305-UC06-T01_複数配送 - 同じ商品種別(同一配送先) --------
762
        // 複数配送設定
763
        MultipleShippingPage::at($I)
764
            ->お届け先追加()
765
            ->入力_お届け先('0', '0', $customer->getName01())
766
            ->入力_お届け先('0', '1', $customer->getName01())
767
            ->入力_数量('0', '0', $shipping1_quantity)
768
            ->入力_数量('0', '1', $shipping2_quantity)
769
            ->選択したお届け先に送る()
770
        ;
771
772
        // 配送先が1個なので数量をまとめる
773
        $sum_quantity = $shipping1_quantity + $shipping2_quantity;
774
775
        // 複数配送設定がされておらず、個数が1明細にまとめられていることを確認
776
        $I->see('お届け先', '#shopping-form > div > div.ec-orderRole__detail > div.ec-orderDelivery > div:nth-child(2)');
777
        $I->dontSee('お届け先(1)', '#shopping-form > div > div.ec-orderRole__detail > div.ec-orderDelivery > div:nth-child(2)');
778
        $I->dontSee('お届け先(2)', '#shopping-form > div > div.ec-orderRole__detail > div.ec-orderDelivery > div:nth-child(6)');
779
        $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)');
780
        $I->see($customer->getName01(), '#shopping-form > div > div.ec-orderRole__detail > div.ec-orderDelivery > div:nth-child(4) > p:nth-child(1)');
781
782
        // -------- EF0305-UC06-T02_複数配送 - 同じ商品種別(別配送先) --------
783
784
        ShoppingPage::at($I)->お届け先追加();
785
786
        // 複数配送設定
787
        MultipleShippingPage::at($I)
788
            ->お届け先追加()
789
            ->入力_お届け先('0', '0', $customer->getName01())
790
            ->入力_お届け先('0', '1', $nameSei)
791
            ->入力_数量('0', '0', $shipping1_quantity)
792
            ->入力_数量('0', '1', $shipping2_quantity)
793
            ->選択したお届け先に送る()
794
        ;
795
796
        // 名前を比較してお届け先が上下どちらに表示されるか判断
797
        $compared = strnatcmp($customer->getName01(), $nameSei);
798
        if ($compared === 0) {
799
            $compared = strnatcmp($customer->getName02(), $nameMei);
800
        }
801
        // 上下それぞれで名前、商品個数を設定
802 View Code Duplication
        if ($compared < 0) {
0 ignored issues
show
Duplication introduced by
This code seems to be duplicated across 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...
803
            $quantity1 = $shipping1_quantity;
804
            $quantity2 = $shipping2_quantity;
805
            $name1 = $customer->getName01();
806
            $name2 = $nameSei;
807
        } else {
808
            $quantity1 = $shipping2_quantity;
809
            $quantity2 = $shipping1_quantity;
810
            $name1 = $nameSei;
811
            $name2 = $customer->getName01();
812
        }
813
814
        // 複数配送設定ができていることを確認
815
        $I->see('お届け先(1)', '#shopping-form > div > div.ec-orderRole__detail > div.ec-orderDelivery > div:nth-child(2)');
816
        $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)');
817
        $I->see($name1, '#shopping-form > div > div.ec-orderRole__detail > div.ec-orderDelivery > div:nth-child(4) > p:nth-child(1)');
818
        $I->see('お届け先(2)', '#shopping-form > div > div.ec-orderRole__detail > div.ec-orderDelivery > div:nth-child(6)');
819
        $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)');
820
        $I->see($name2, '#shopping-form > div > div.ec-orderRole__detail > div.ec-orderDelivery > div:nth-child(8) > p:nth-child(1)');
821
822
        // 商品詳細パーコレータ カートへ
823
        ProductDetailPage::go($I, 2)
824
            ->カートに入れる($cart_quantity)
825
            ->カートへ進む();
826
827
        // 一旦カートに戻る
828
        CartPage::go($I)
829
            ->レジに進む();
830
831
        // カートに変更があったため、お届け先を初期化
832
        $I->see('お届け先', '#shopping-form > div > div.ec-orderRole__detail > div.ec-orderDelivery > div:nth-child(2)');
833
        $I->dontSee('お届け先(1)', '#shopping-form > div > div.ec-orderRole__detail > div.ec-orderDelivery > div:nth-child(2)');
834
        $I->dontSee('お届け先(2)', '#shopping-form > div > div.ec-orderRole__detail > div.ec-orderDelivery > div:nth-child(6)');
835
        $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)');
836
        $I->see($customer->getName01(), '#shopping-form > div > div.ec-orderRole__detail > div.ec-orderDelivery > div:nth-child(4) > p:nth-child(1)');
837
838
        ShoppingPage::at($I)->確認する();
839
        ShoppingConfirmPage::at($I)->注文する();
840
841
        $I->wait(1);
842
843
        // メール確認
844
        $I->seeEmailCount(2);
845
        foreach ([$customer->getEmail(), $BaseInfo->getEmail01()] as $email) {
0 ignored issues
show
Bug introduced by
The method getEmail() does not seem to exist on object<Eccube\Entity\CustomerAddress>.

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
846
            $I->seeInLastEmailSubjectTo($email, 'ご注文ありがとうございます');
847
            $I->seeInLastEmailTo($email, $customer->getName01().' '.$customer->getName02().' 様');
848
            $I->seeInLastEmailTo($email, 'お名前 :'.$customer->getName01().' '.$customer->getName02().' 様');
849
            $I->seeInLastEmailTo($email, 'お名前(フリガナ):'.$customer->getKana01().' '.$customer->getKana02().' 様');
850
            $I->seeInLastEmailTo($email, '郵便番号:〒'.$customer->getPostalCode());
851
            $I->seeInLastEmailTo($email, '住所  :'.$customer->getPref()->getName().$customer->getAddr01().$customer->getAddr02());
852
            $I->seeInLastEmailTo($email, '電話番号:'.$customer->getPhoneNumber());
853
            $I->seeInLastEmailTo($email, 'メールアドレス:'.$customer->getEmail());
0 ignored issues
show
Bug introduced by
The method getEmail() does not seem to exist on object<Eccube\Entity\CustomerAddress>.

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
854
            $I->seeInLastEmailTo($email, '◎お届け先');
855
            $I->seeInLastEmailTo($email, 'お名前 :'.$customer->getName01());
856
            $I->seeInLastEmailTo($email, '数量:'.($sum_quantity + $cart_quantity));
857
        }
858
859
        // 完了画面 -> topへ
860
        ShoppingCompletePage::at($I)->TOPへ();
861
        $I->see('新着情報', '.ec-news__title');
862
    }
863
864
    public function order_複数配送設定画面での販売制限エラー(\AcceptanceTester $I)
865
    {
866
        /* @var Customer $Customer */
867
        $Customer = (Fixtures::get('createCustomer'))();
868
869
        ProductDetailPage::go($I, 2)
870
            ->カートに入れる(1)
871
            ->カートへ進む();
872
873
        CartPage::at($I)
874
            ->レジに進む();
875
876
        ShoppingLoginPage::at($I)
877
            ->ログイン($Customer->getEmail());
878
879
        ShoppingPage::at($I)
880
            ->お届け先追加();
881
882
        MultipleShippingPage::at($I)
883
            ->入力_数量('0', '0', 100)
884
            ->選択したお届け先に送る();
885
886
        MultipleShippingPage::at($I);
887
888
        $I->see('選択された商品(パーコレーター)は販売制限しております。', 'p.errormsg');
889
    }
890
891
    public function order_複数ブラウザでログインしてカートに追加する(\AcceptanceTester $I)
892
    {
893
        $I->logoutAsMember();
894
        $I->saveSessionSnapshot('not_login');
895
896
        $createCustomer = Fixtures::get('createCustomer');
897
        /** @var Customer $customer */
898
        $customer = $createCustomer();
899
900
        // ブラウザ1ログイン
901
        $I->loginAsMember($customer->getEmail(), 'password');
902
        $I->saveSessionSnapshot('browser1');
903
904
        // ブラウザ2ログイン
905
        $I->loadSessionSnapshot('not_login');
906
        $I->loginAsMember($customer->getEmail(), 'password');
907
        $I->saveSessionSnapshot('browser2');
908
909
        /*
910
         * ブラウザ1でカートに商品を入れる
911
         */
912
        $I->loadSessionSnapshot('browser1');
913
914
        $CartPage = ProductDetailPage::go($I, 2)
915
            ->カートに入れる(1)
916
            ->カートへ進む();
917
918
        $I->assertEquals(1, $CartPage->明細数());
919
        $I->assertEquals('パーコレーター', $CartPage->商品名(1));
920
921
        /*
922
         * ブラウザ2にのカートにも反映されている
923
         */
924
        $I->loadSessionSnapshot('browser2');
925
926
        $CartPage = CartPage::go($I);
927
928
        $I->assertEquals(1, $CartPage->明細数());
929
        $I->assertEquals('パーコレーター', $CartPage->商品名(1));
930
    }
931
932
933
    public function order_複数ブラウザ_片方でログインしてカートに追加しもう一方にログインして別の商品を追加する(\AcceptanceTester $I)
934
    {
935
        $I->logoutAsMember();
936
        $I->saveSessionSnapshot('not_login');
937
938
        $createCustomer = Fixtures::get('createCustomer');
939
        /** @var Customer $customer */
940
        $customer = $createCustomer();
941
942
        // ブラウザ1ログイン
943
        $I->loginAsMember($customer->getEmail(), 'password');
944
        $I->saveSessionSnapshot('browser1');
945
946
        /*
947
         * ブラウザ1でカートに商品を入れる
948
         */
949
        $I->loadSessionSnapshot('browser1');
950
951
        $CartPage = ProductDetailPage::go($I, 2)
952
            ->カートに入れる(1)
953
            ->カートへ進む();
954
955
        $I->assertEquals(1, $CartPage->明細数());
956
        $I->assertContains('パーコレーター', $CartPage->商品名(1));
957
958
        /*
959
         * ブラウザ2で未ログインのまま別の商品を入れる
960
         */
961
        $I->loadSessionSnapshot('not_login');
962
        $CartPage = ProductDetailPage::go($I, 1)
963
            ->カートに入れる(1, ['1' => '金'], ['4' => '120mm'])
964
            ->カートへ進む();
965
966
        $I->assertEquals(1, $CartPage->明細数());
967
        $I->assertContains('ディナーフォーク', $CartPage->商品名(1));
968
969
        /*
970
         * ブラウザ2でログインするとブラウザ1のカートとマージされている
971
         */
972
        $I->loginAsMember($customer->getEmail(), 'password');
973
974
        $CartPage = CartPage::go($I);
975
        $I->assertEquals(2, $CartPage->明細数());
976
        $itemNames = $I->grabMultiple(['css' => '.ec-cartRow__name a']);
977
        $I->assertContains('ディナーフォーク', $itemNames);
978
        $I->assertContains('パーコレーター', $itemNames);
979
980
        /*
981
         * ブラウザ1のカートもマージされている
982
         */
983
        $I->loadSessionSnapshot('browser1');
984
985
        $CartPage = CartPage::go($I);
986
        $I->assertEquals(2, $CartPage->明細数());
987
        $itemNames = $I->grabMultiple(['css' => '.ec-cartRow__name a']);
988
        $I->assertContains('ディナーフォーク', $itemNames);
989
        $I->assertContains('パーコレーター', $itemNames);
990
    }
991
}
992