New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix #4209 商品の在庫数が足りないときに受注のステータスを「注文取消し」から「対応中」に変更しすると、システムエラーが発生する不具合を修正 #4400
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
1点コメントしました。
落ちているテストについて、ここはテスト自体が間違っているので、テストを修正した方が良いかと思います。
落ちているテストは以下の関数です。
ec-cube/tests/Eccube/Tests/Service/PurchaseFlow/Processor/StockDiffProcessorTest.php
Lines 53 to 63 in 37ab7e2
/** | |
* @dataProvider validateProvider | |
* | |
* @param $stock int 在庫数 | |
* @param $beforeQuantity int 編集前の商品の数量 | |
* @param $afterQuantity int 編集後の商品の数量 | |
* @param $isError bool バリデーションエラーがある場合はtrue | |
* @param $beforeOrderStatus int 編集前の受注ステータス | |
* @param $afterOrderStatus int 編集後の受注ステータス | |
*/ | |
public function testValidate($stock, $beforeQuantity, $afterQuantity, $isError, $beforeOrderStatus, $afterOrderStatus) |
テストケースについては以下の関数で定義されています。
ec-cube/tests/Eccube/Tests/Service/PurchaseFlow/Processor/StockDiffProcessorTest.php
Lines 110 to 115 in 37ab7e2
public function validateProvider() | |
{ | |
return [ | |
[10, 2, 12, false, OrderStatus::NEW, OrderStatus::NEW], | |
[1, 3, 2, false, OrderStatus::NEW, OrderStatus::PAID], | |
[1, 1, 2, false, OrderStatus::NEW, OrderStatus::IN_PROGRESS], |
テストケースの中の以下のテストケースが落ちていました。
ec-cube/tests/Eccube/Tests/Service/PurchaseFlow/Processor/StockDiffProcessorTest.php
Line 125 in 37ab7e2
[1, 1, 2, false, OrderStatus::CANCEL, OrderStatus::IN_PROGRESS], |
配列の要素はそれぞれ以下を表します。
- 在庫数:1
- 編集前の商品の数量:1
- 編集後の商品の数量:2
- バリデーションエラーの有無:なし
- 編集前の受注ステータス:キャンセル
- 編集後の受注ステータス:対応中
今回の修正でこのケースでは、エラーになるのが正しい挙動となりました。
このケースはエラーなしのケースとするのが良いかと思いますので、「編集後の商品の数量」を1個にする修正でいかがでしょうか。
@yoshiharu-semachi |
概要(Overview・Refs Issue)
修正したIssue:#4209
このPull Requestは以前作成したPR #4379 の修正版となります。
okazyさんに上記PRのレビューをしていただき、その内容を踏まえて修正しました。
実装に関する補足(Appendix)
StockDiffProcessor
EditController
参考
受注対応状況の流れ - EC-CUBE 4.0 開発者向けドキュメント
Service のカスタマイズ - EC-CUBE 4.0 開発者向けドキュメント
テスト(Test)
以下の手順で「<商品名>の在庫が足りません。」と表示されることを確認
対応状況:注文取消し
、数量:1
に設定し商品を登録する。在庫数:0
で登録する。対応状況:対応中
に変更し登録する。在庫数:0
のままになっていることを確認。マイナーバージョン互換性保持のための制限事項チェックリスト
レビュワー確認項目