Skip to content

feat: 注文手続きで配送方法・支払い方法の保存と復元を追加 (#6819)#6833

Open
ttokoro20240902 wants to merge 10 commits into
4.4from
feature/preferred-shipping-payment
Open

feat: 注文手続きで配送方法・支払い方法の保存と復元を追加 (#6819)#6833
ttokoro20240902 wants to merge 10 commits into
4.4from
feature/preferred-shipping-payment

Conversation

@ttokoro20240902

@ttokoro20240902 ttokoro20240902 commented Jun 12, 2026

Copy link
Copy Markdown
Contributor

Resolves #6819

概要

会員が注文手続きで使用した配送方法・支払い方法を保存し、次回以降の注文時に**「この設定を使用する」ボタンで手動復元**できる機能を本体に追加します。復元は自動適用せず、ユーザーが明示的にボタンを押したときのみ Order/Shipping に保存値を適用して合計金額を再計算します。保存は会員 1 人につき 1 組(上書き)です。

  • 対象: 会員のみ・単一配送先のみ(ゲスト・複数配送先は対象外)
  • 対象画面: 注文手続き(/shopping)/ 注文確認(/shopping/confirm)/ 注文完了(/shopping/complete

スクリーンショット

メモ(貼り付け用): 各見出しの直下に、対応するローカル画像をドラッグ&ドロップで貼り付けてください。各セクションは「該当項目+属するセクション」が収まるよう撮影しているため、画面内の位置・レイアウトが確認できます。

① 注文手続き画面: 保存された設定の情報ボックス(/shopping

保存済みの会員に表示される「保存された設定があります」ボックスと「この設定を使用する」ボタン。「お客様情報」と「配送情報」の間に配置されることが分かります。

pr6833-B-preferred-infobox

② 注文手続き画面: 手動復元の成功メッセージ(/shopping

「この設定を使用する」を押した後の success フラッシュ「保存された設定を適用しました」。ステップナビ直下に成功用スタイル(緑)で表示されます。

pr6833-B-restore-success

③ 注文手続き画面: 保存設定が利用不可のときの警告(/shopping

保存された支払い方法が非公開等で利用できない場合、情報ボックスの代わりに警告「保存された支払い方法が現在利用できません」を同じ位置に表示します。

pr6833-C-unavailable-warning

④ 注文確認画面: 保存チェックボックス(/shopping/confirm

合計ボックス内(合計金額と「注文する」ボタンの間)の「この配送方法と支払い方法を保存する」チェックボックス。

pr6833-A-confirm-save-checkbox

実装内容

区分 内容
Entity CustomerPreferredPayment / PreferredDelivery(ManyToOne, onDelete: SET NULL)を追加
Controller validatePreferredShippingPayment()(表示・復元で共用の検証)、POST /shopping/restore_preferred(会員のみ・CSRF 必須)、checkout の保存処理(失敗しても注文は継続)、confirmisMultipleShipping 受け渡し
Form OrderTypesave_preferred_shipping_payment(会員時に常時定義・表示はテンプレートで単一配送先のみ)
Template index(情報ボックス・復元ボタン・警告)/ confirm(保存チェックボックス)/ complete(保存失敗メッセージ)/ alert(success フラッシュ表示)
i18n front.shopping.preferred_* を ja / en に追加

設計上の判断

  • マイグレーションは作成しません。スキーマの源泉は Entity 属性であり、カラム追加・外部キーは doctrine:schema:create / schema:update --force が反映します(本体のスキーマ管理規約)。
  • 復元はサーバーサイド方式formactionPOST /shopping/restore_preferred)。注文手続き画面は画面全体が 1 つの <form> のためフォームのネストは不可。クライアント JS で配送セレクト・支払ラジオを書き換える方式は、選択中の配送方法によっては保存支払方法のラジオが未描画で復元しきれない/非公開・組み合わせ・販売種別の検証をサーバーで担保できない/機能テストで担保できない、ため採用しません。
  • 保存チェックボックスは会員時に常に定義します。単一配送先のときだけ動的追加する方式だと、複数配送先で当該フィールドを含む細工 POST が extra fields エラーとなり注文自体が失敗するため。表示はテンプレートで単一配送先のみに制御し、複数配送先時の送信値は注文確定処理でスキップします。
  • 検証は本体既存の DeliveryRepository::getDeliveries() / PaymentRepository::findAllowedPayments() を利用し、独自の重複ロジックを作りません。

テスト

  • UT: validatePreferredShippingPayment 14 件(検証順・販売種別・組み合わせ)
  • Entity: アクセサ・永続化・ON DELETE SET NULL 3 件
  • 機能(Web): 表示 / 復元 / 保存 / ゲスト 403 / 非公開時の警告 / 複数配送先(情報ボックスのみ表示・復元スキップ・確定時保存スキップ)13 件
  • E2E(Playwright): 保存 → 情報ボックス表示 → 手動復元のジャーニーを e2e/tests/front-order.spec.ts に追加(受注一覧 表示項目設定 ではなく Front Order 配送方法・支払い方法の保存と復元 describe)
  • PHPStan(level 6, 変更ファイル)/ PHP-CS-Fixer はパス

E2E の matrix 登録について

本 PR の E2E は front-order.spec.ts に統合しています。front-order suite は従来 e2e-test.yml の matrix に未登録で CI 実行されていなかったため、#6829 と同一の matrix 登録コミットを cherry-pick で含めています(front-order / front-mypage / front-invoice)。#6829 が先にマージされた場合も同一内容のため Git が吸収します。

🤖 Generated with Claude Code

Summary by CodeRabbit

Summary

  • 新機能
    • 会員が注文手続きで「配送方法・支払い方法」を保存し、次回購入で保存内容を復元して適用できるようになりました。
  • UI
    • 保存済み設定の表示、利用不可時の警告、適用成功/保存失敗の表示を追加しました(複数配送先は制限あり)。
  • テスト
    • Web/単体/E2Eのシナリオ追加で、保存・復元・例外系を検証しました。
  • ローカライズ
    • 保存/復元関連の文言を追加しました。
  • Chores
    • E2Eテスト対象スイートに追加分を反映しました。

ttokoro20240902 and others added 6 commits June 12, 2026 10:00
dtb_customer に preferred_payment_id / preferred_delivery_id を追加し、
ON DELETE SET NULL で参照先削除時は自動的に未設定へ戻す。
スキーマは Entity 属性から schema:update で反映するためマイグレーションは作成しない。

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
- ShoppingController に検証共通メソッドと POST /shopping/restore_preferred を追加
- 注文確定時にチェックボックス ON で会員へ保存(失敗しても注文は継続)
- OrderType に save_preferred_shipping_payment を会員かつ単一配送先のみ動的追加
- 注文手続き画面に情報ボックス・復元ボタン・警告、確認画面にチェックボックス、
  完了画面に保存失敗メッセージを追加
- front.shopping.preferred_* の翻訳キーを追加

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
- validatePreferredShippingPayment の単体テスト(検証順・販売種別・組み合わせ)
- Customer の優先設定アクセサ・永続化・ON DELETE SET NULL のテスト
- 表示/復元/保存チェックボックス/確定時保存/ゲスト 403 の機能テスト

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
単一配送先のときだけ動的追加する方式では, 複数配送先の注文確定時に
save_preferred_shipping_payment を含む細工した POST が extra fields エラーとなり
注文自体が失敗する。フィールドは会員なら常に定義し, 表示はテンプレートで
単一配送先のみに制御, 複数配送先時の送信値は確定処理でスキップする。

複数配送先の機能テスト(情報ボックスのみ表示・復元スキップ・確定時保存スキップ)を追加。

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
保存(チェックボックスONで注文)→ 情報ボックス表示 → 手動復元のジャーニーを
front-order.spec.ts の serial describe として追加(既存ヘルパーを再利用)。
CI での実行は front-order suite の matrix 登録(#6829)に依存する。

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
e2e-test.yml の matrix は許可リストであり, 列挙されていない spec は CI で実行されない。
front-order(16件) / front-mypage(10件+skip 1) / front-invoice(2件) は
テストカバレッジ向上で追加された際から matrix 未登録のままで, 一度も CI で実行されていなかった。

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@coderabbitai

coderabbitai Bot commented Jun 12, 2026

Copy link
Copy Markdown

Review Change Stack

Note

Reviews paused

It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: b6d6bffc-aae0-4609-8610-553a78e00e96

📥 Commits

Reviewing files that changed from the base of the PR and between 145e2b6 and 2115428.

📒 Files selected for processing (2)
  • src/Eccube/Controller/ShoppingController.php
  • tests/Eccube/Tests/Web/ShoppingControllerPreferredShippingPaymentTest.php
🚧 Files skipped from review as they are similar to previous changes (2)
  • tests/Eccube/Tests/Web/ShoppingControllerPreferredShippingPaymentTest.php
  • src/Eccube/Controller/ShoppingController.php

📝 Walkthrough

Walkthrough

Customer に優先配送・優先支払いを持たせ、注文フローで保存・検証・手動復元できるようにし、テンプレート文言・完了画面の表示、成功アラートスタイル、単体/Web/E2E テスト、CI スイート登録を追加しています。

Changes

配送方法・支払い方法の保存と復元機能

Layer / File(s) Summary
データモデル拡張と Entity テスト
src/Eccube/Entity/Customer.php, tests/Eccube/Tests/Entity/CustomerTest.php
CustomerPreferredPaymentPreferredDelivery ManyToOne リレーション(削除時 SET NULL)とアクセサを追加し、アクセサの初期値・永続化・参照削除時のリセットを Entity テストで検証。
コントローラ依存注入とテンプレートデータ追加
src/Eccube/Controller/ShoppingController.php
Delivery/Payment リポジトリの use とコンストラクタ注入を追加。index()/redirectTo()/confirm() で validatePreferredShippingPayment の結果(preferred* / isMultipleShipping / preferredUnavailableReason)をテンプレートへ渡す。
検証ロジック(validatePreferredShippingPayment)
src/Eccube/Controller/ShoppingController.php, tests/Eccube/Tests/Controller/ShoppingControllerValidatePreferredShippingPaymentTest.php
保存情報の有無・可視性・配送種別・支払い組合せを段階的に検証する private メソッドを実装。ID/名称/複数配送フラグ/利用不可理由を返し、ユニットテストで多様なパターンと repository 呼び出し引数を検証。
復元エンドポイント・表示・テンプレート・文言・スタイル
src/Eccube/Controller/ShoppingController.php, src/Eccube/Resource/template/default/Shopping/index.twig, src/Eccube/Resource/template/default/Shopping/confirm.twig, src/Eccube/Resource/template/default/Shopping/complete.twig, src/Eccube/Resource/template/default/Shopping/alert.twig, src/Eccube/Resource/locale/messages.ja.yaml, src/Eccube/Resource/locale/messages.en.yaml, html/template/default/assets/scss/project/_15.1.cart.scss
restorePreferred() を POST /shopping/restore_preferred として追加。会員チェック、受注存在確認、単一配送チェック、検証・反映・再集計を行い、成功/警告メッセージをセットしてリダイレクトする。index に情報ボックスと復元ボタン/警告を追加。alert.twig で成功フラッシュ表示、complete.twig に保存失敗フラッシュ警告、confirm.twig に会員・単一配送時の保存チェックボックス UI を追加。front.shopping.preferred_* 系ロケール文言を追加。成功アラート用スタイルを SCSS に追加。
保存ロジックとフォーム拡張
src/Eccube/Form/Type/Shopping/OrderType.php, src/Eccube/Controller/ShoppingController.php
OrderType に会員向け save_preferred_shipping_payment チェックボックス(mapped:false)を追加し、checkout()savePreferredShippingPayment() を呼び出して会員・単一配送・フォーム指定時に Customer へ保存する(例外は注文継続・フラッシュ通知)。
保存処理ユニットテスト
tests/Eccube/Tests/Controller/ShoppingControllerSavePreferredShippingPaymentTest.php
flush 例外処理・フラッシュ投入・スキップ条件(複数配送・チェックボックス OFF)をテスト化。リフレクション経由で private メソッドを直接検証。
Web 統合テスト
tests/Eccube/Tests/Web/ShoppingControllerPreferredShippingPaymentTest.php
表示・復元・保存(会員/ゲスト・複数配送・非公開支払など)のユーザージャーニーをテスト化。復元エンドポイント、保存チェックボックス表示・保存挙動、複数配送時のスキップを検証。
Playwright E2E テストと CI 登録
e2e/tests/front-order.spec.ts, .github/workflows/e2e-test.yml
保存→次回復元のシリアルシナリオを front-order スイートに追加。配送・支払いの保存、完了後の情報ボックス表示、復元フロー、再計算・再描画を検証。ワークフロー matrix に front-orderfront-mypagefront-invoice を登録して E2E 実行対象に追加。

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~60 minutes

Possibly related PRs

  • EC-CUBE/ec-cube#6829: .github/workflows/e2e-test.ymlmatrix.suitefront-order / front-mypage / front-invoice を追加する同じマトリクス登録を行うため、ワークフロー定義領域で強く関連しています。

Suggested reviewers

  • nanasess
  • dotani1111

Poem

🐰 コード畑でぴょんと跳ねてきたよ、
会員の好みをポケットにしまったよ。
次の買い物で「これ使う」をぽちっ、
配送も決済もすぐに戻るよ、ぴょん。
小さなウサギが今日もデプロイ祝うよ 🥕

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed PRのタイトルは、配送方法・支払い方法の保存と復元機能の追加という主要な変更を明確に要約しており、変更内容と密接に関連しています。
Linked Issues check ✅ Passed PR実装は#6819の全ての受入基準を満たしており、表示・復元・保存機能、エンティティ拡張、ルーティング、テスト、セキュリティ要件を完全に実装しています。
Out of Scope Changes check ✅ Passed すべての変更は#6819で定義された配送方法・支払い方法の保存/復元機能の実装に関連しており、スコープ外の変更は含まれていません。
Docstring Coverage ✅ Passed Docstring coverage is 84.06% which is sufficient. The required threshold is 80.00%.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feature/preferred-shipping-payment

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 3

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
src/Eccube/Controller/ShoppingController.php (1)

439-444: ⚠️ Potential issue | 🟠 Major | ⚡ Quick win

confirm() のエラー戻りで保存済み設定の文脈が落ちています。

ここは Shopping/index.twig を再表示しているのに、index() / redirectTo() で渡している preferredPaymentId / preferredDeliveryId / preferredUnavailableReason / isMultipleShipping が返却値に含まれていません。 この分岐だけ保存済み設定の表示・警告が消えるか、テンプレート側が直接参照していれば未定義変数になります。

差分案
         return [
             'form' => $form->createView(),
             'Order' => $Order,
             'activeTradeLaws' => $activeTradeLaws,
             'Prefs' => $this->prefRepository->findAll(),
+            'preferredPaymentId' => $preferredInfo['preferredPaymentId'],
+            'preferredPaymentName' => $preferredInfo['preferredPaymentName'],
+            'preferredDeliveryId' => $preferredInfo['preferredDeliveryId'],
+            'preferredDeliveryName' => $preferredInfo['preferredDeliveryName'],
+            'isMultipleShipping' => $preferredInfo['isMultipleShipping'],
+            'preferredUnavailableReason' => $preferredInfo['preferredUnavailableReason'],
         ];

Based on PR objectives, indexredirectToconfirm から同じ検証結果をテンプレートへ返す前提です.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@src/Eccube/Controller/ShoppingController.php` around lines 439 - 444, The
confirm() error-return branch is missing the saved-preference context keys that
index() and redirectTo() supply, causing the template to lose
preferredPaymentId, preferredDeliveryId, preferredUnavailableReason and
isMultipleShipping; update the return array in ShoppingController::confirm() to
include those same keys (pulling values from the same sources used by
index()/redirectTo(), e.g., the request/session or the Order object) so the
template receives identical validation/context data.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@src/Eccube/Controller/ShoppingController.php`:
- Around line 1064-1069: The loop treating $allowedPayments as Payment objects
is wrong because PaymentRepository::findAllowedPayments() returns rows as arrays
(e.g. ['id' => ...]); update the foreach over $allowedPayments (in
ShoppingController where $allowedPayments is populated from
$this->paymentRepository->findAllowedPayments) to handle both shapes: if the
item is an object call ->isVisible() and ->getId(), otherwise treat it as an
array and read the id and visibility keys (e.g. $row['id'] and $row['visible']
or fallback $row['is_visible']) before pushing into $allowedPaymentIds. Ensure
the branch covers both cases so existing tests that return mocks still work and
real repository rows don’t cause fatal errors.

In `@src/Eccube/Resource/template/default/Shopping/alert.twig`:
- Around line 19-30: 現在のループで `eccube.front.success` のフラッシュメッセージが
`ec-cartRole__error` /
`ec-alert-warning`(エラー/警告用クラス)で包まれているため、成功メッセージ用に見た目を分離してください:`eccube.front.success`
を出力している該当テンプレート内のループ(現在の for-block)を見つけ、ラッパーのクラス名をエラー/警告用から成功専用(例:
`ec-cartRole__success` と `ec-alert-success`
などプロジェクトの命名規則に沿った名前)に差し替え、既存の翻訳/改行処理(`{{ success|trans|nl2br }}`)はそのまま残すことと、対応する
CSS スタイルを追加/調整して成功メッセージが警告と異なる外観になるようにしてください。

In `@src/Eccube/Resource/template/default/Shopping/index.twig`:
- Around line 334-335: The template adds a duplicate CSRF hidden input (name
constant('Eccube\\Common\\Constant::TOKEN_NAME')) inside the same form that
already contains form._token, which can overwrite the token when submitting to
shopping_confirm; fix this by moving the restore button (the <button ...
formaction="{{ url('shopping_restore_preferred') }}" ...> with its hidden token
input) into its own separate <form> so it has its own CSRF token and does not
interfere with the main shopping_confirm form, ensuring the original form keeps
only its existing form._token and the new restore form renders its own
csrf_token(constant('Eccube\\Common\\Constant::TOKEN_NAME')).

---

Outside diff comments:
In `@src/Eccube/Controller/ShoppingController.php`:
- Around line 439-444: The confirm() error-return branch is missing the
saved-preference context keys that index() and redirectTo() supply, causing the
template to lose preferredPaymentId, preferredDeliveryId,
preferredUnavailableReason and isMultipleShipping; update the return array in
ShoppingController::confirm() to include those same keys (pulling values from
the same sources used by index()/redirectTo(), e.g., the request/session or the
Order object) so the template receives identical validation/context data.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 4dbb763b-7fad-4d54-a153-c7837e4daaef

📥 Commits

Reviewing files that changed from the base of the PR and between f2711b3 and d2a2031.

📒 Files selected for processing (14)
  • .github/workflows/e2e-test.yml
  • e2e/tests/front-order.spec.ts
  • src/Eccube/Controller/ShoppingController.php
  • src/Eccube/Entity/Customer.php
  • src/Eccube/Form/Type/Shopping/OrderType.php
  • src/Eccube/Resource/locale/messages.en.yaml
  • src/Eccube/Resource/locale/messages.ja.yaml
  • src/Eccube/Resource/template/default/Shopping/alert.twig
  • src/Eccube/Resource/template/default/Shopping/complete.twig
  • src/Eccube/Resource/template/default/Shopping/confirm.twig
  • src/Eccube/Resource/template/default/Shopping/index.twig
  • tests/Eccube/Tests/Controller/ShoppingControllerValidatePreferredShippingPaymentTest.php
  • tests/Eccube/Tests/Entity/CustomerTest.php
  • tests/Eccube/Tests/Web/ShoppingControllerPreferredShippingPaymentTest.php

Comment thread src/Eccube/Controller/ShoppingController.php
Comment thread src/Eccube/Resource/template/default/Shopping/alert.twig
Comment thread src/Eccube/Resource/template/default/Shopping/index.twig
受入基準のうち機能テストで埋めにくかった 2 点を補完する。
- savePreferredShippingPayment の単体テスト: flush 例外を飲み込み注文を継続し、
  注文完了画面用フラッシュ(preferred_save_error)を積むこと。複数配送先・OFF の
  保存スキップも単体で固定。EntityManager をモックして例外を注入する。
- 注文手続き画面の初期表示で、保存情報が利用不可のとき警告を表示し復元ボタンを
  出さないこと(index テンプレートの preferredUnavailableReason 描画経路)。

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🧹 Nitpick comments (1)
tests/Eccube/Tests/Controller/ShoppingControllerSavePreferredShippingPaymentTest.php (1)

73-75: ReflectionClass の対象をモックではなく ShoppingController::class に固定してください(テストの安定性向上)

  • 本テストでは ReflectionClass($this->controller)entityManager / session を差し替えていますが、これらは AbstractController 側の protected プロパティです。
  • 一方で savePreferredShippingPayment()ShoppingController 側で private なので、反射対象は ShoppingController::class に固定して PHPUnit モック生成物への依存を減らすのが安全です(73-75、183-185)。
修正例
-        $reflection = new \ReflectionClass($this->controller);
+        $reflection = new \ReflectionClass(ShoppingController::class);
         $reflection->getProperty('entityManager')->setValue($this->controller, $this->entityManager);
         $reflection->getProperty('session')->setValue($this->controller, $session);
@@
-        $reflection = new \ReflectionClass($this->controller);
+        $reflection = new \ReflectionClass(ShoppingController::class);
         $method = $reflection->getMethod('savePreferredShippingPayment');
         $method->invoke($this->controller, $Order, $form);
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In
`@tests/Eccube/Tests/Controller/ShoppingControllerSavePreferredShippingPaymentTest.php`
around lines 73 - 75, Replace ReflectionClass($this->controller) with
ReflectionClass(ShoppingController::class) when setting protected properties so
the reflection targets the concrete ShoppingController class instead of the
PHPUnit mock; update both occurrences that set entityManager and session (the
code that prepares for calling the private savePreferredShippingPayment method)
to use ShoppingController::class to avoid coupling tests to the mock instance
and ensure stable access to the protected/private members.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In
`@tests/Eccube/Tests/Controller/ShoppingControllerSavePreferredShippingPaymentTest.php`:
- Around line 1-14: The EC-CUBE license header is placed after the
declare(strict_types=1); directive; move the entire license comment block so it
appears immediately after the opening <?php tag and before
declare(strict_types=1); to comply with the PHP file header guideline; locate
the current license comment and the declare(strict_types=1); statement in
Tests/Controller/ShoppingControllerSavePreferredShippingPaymentTest.php and
reorder them so the license block precedes the declare line.

---

Nitpick comments:
In
`@tests/Eccube/Tests/Controller/ShoppingControllerSavePreferredShippingPaymentTest.php`:
- Around line 73-75: Replace ReflectionClass($this->controller) with
ReflectionClass(ShoppingController::class) when setting protected properties so
the reflection targets the concrete ShoppingController class instead of the
PHPUnit mock; update both occurrences that set entityManager and session (the
code that prepares for calling the private savePreferredShippingPayment method)
to use ShoppingController::class to avoid coupling tests to the mock instance
and ensure stable access to the protected/private members.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 19c367ee-3a25-41b4-a483-a2ad6771cc17

📥 Commits

Reviewing files that changed from the base of the PR and between d2a2031 and dbaa36b.

📒 Files selected for processing (2)
  • tests/Eccube/Tests/Controller/ShoppingControllerSavePreferredShippingPaymentTest.php
  • tests/Eccube/Tests/Web/ShoppingControllerPreferredShippingPaymentTest.php
🚧 Files skipped from review as they are similar to previous changes (1)
  • tests/Eccube/Tests/Web/ShoppingControllerPreferredShippingPaymentTest.php

ttokoro20240902 and others added 2 commits June 12, 2026 16:48
CI の rector が検出したテストコードの code-quality 指摘を適用。
createStub への置換・assertInstanceOf 化・(string) キャスト等。挙動変更なし。

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
CodeRabbit 指摘対応:
- 成功フラッシュ(eccube.front.success)を ec-alert-warning(警告) から
  ec-alert-success へ分離。外側も ec-cartRole__success に改名し意味を一致
- _15.1.cart.scss に .ec-alert-success(緑背景) を追加

CI(sqlite) 失敗対応:
- CustomerTest::testPreferredResetToNullWhenReferenceDeleted は
  外部キー ON DELETE SET NULL を検証するが, sqlite は FK を既定で
  強制しないため markTestSkipped(pgsql/mysql で担保)

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@html/template/default/assets/scss/project/_15.1.cart.scss`:
- Line 452: The success alert component has insufficient text contrast between
the background color `#5cb85c` (line 452) and the text color `#fff` (line 469),
which fails accessibility requirements for regular text. To fix this, either
darken the background color value at line 452 to increase contrast with the
white text, or adjust the text color at line 469 to a darker shade that provides
better contrast against the green background. Ensure the final combination meets
WCAG AA contrast ratio requirements for normal text.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 8278db48-2ab3-40d2-b91a-165ea453871e

📥 Commits

Reviewing files that changed from the base of the PR and between ee88652 and 145e2b6.

📒 Files selected for processing (3)
  • html/template/default/assets/scss/project/_15.1.cart.scss
  • src/Eccube/Resource/template/default/Shopping/alert.twig
  • tests/Eccube/Tests/Entity/CustomerTest.php
🚧 Files skipped from review as they are similar to previous changes (2)
  • src/Eccube/Resource/template/default/Shopping/alert.twig
  • tests/Eccube/Tests/Entity/CustomerTest.php

Comment thread html/template/default/assets/scss/project/_15.1.cart.scss
@codecov

codecov Bot commented Jun 15, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 67.30769% with 51 lines in your changes missing coverage. Please review.
✅ Project coverage is 74.89%. Comparing base (fce3244) to head (2115428).
⚠️ Report is 91 commits behind head on 4.4.

Files with missing lines Patch % Lines
src/Eccube/Controller/ShoppingController.php 64.58% 51 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff              @@
##                4.4    #6833      +/-   ##
============================================
- Coverage     75.33%   74.89%   -0.45%     
============================================
  Files           483      463      -20     
  Lines         26277    24185    -2092     
============================================
- Hits          19797    18114    -1683     
+ Misses         6480     6071     -409     
Flag Coverage Δ
Unit 74.89% <67.30%> (-0.45%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@dotani1111 dotani1111 self-assigned this Jun 17, 2026
@dotani1111 dotani1111 added this to the 4.4.0 milestone Jun 17, 2026
保存設定の復元(restorePreferred)で配送方法を差し替える際, 旧配送業者に属するお届け時間(time_id / shipping_delivery_time)が Shipping に残り, 新しい配送業者と不整合になっていた。通常フロー(ShippingType)と同様にクリアする。

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[4.4] 配送方法・支払い方法の保存と復元 — 実装設計

2 participants