Completed
Push — sf/fix-multi-browser-carts ( 96a945 )
by Kiyotaka
167:03 queued 103:04
created

order_複数ブラウザ_片方でログインしてカートに追加しもう一方にログインして別の商品を追加する()   B

Complexity

Conditions 1
Paths 1

Size

Total Lines 56

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
nc 1
nop 1
dl 0
loc 56
rs 8.9599
c 0
b 0
f 0

How to fix   Long Method   

Long Method

Small methods make your code easier to understand, in particular if combined with a good name. Besides, if your method is small, finding a good name is usually much easier.

For example, if you find yourself adding comments to a method's body, this is usually a good sign to extract the commented part to a new method, and use the comment as a starting point when coming up with a good name for this new method.

Commonly applied refactorings include:

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