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