Repository navigation
Symfony7適合 - #59
Symfony7適合#59KenTanaka wants to merge 20 commits into
Conversation
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the ⚙️ Run configuration
You can disable this status message by setting the Use the checkbox below for a quick retry:
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. Comment |
There was a problem hiding this comment.
修正をお願いします。
e2e-testing.ymlは EC-CUBE4.2+ PHP 8.0、ab-testing.ymlは ec-cube の既定ブランチ(4.3)を checkout したまま*44のプラグインを入れる形になっています。44 は 4.4 / PHP 8.2+ 専用のため動きません。4.4 + Playwright 向けに直すか、4.4 ブランチから外してください。- 挙動を変えた次の 2 点に PHPUnit テストを追加してください(CI に PHPUnit を追加していますが、
Tests/には bootstrap しかありません)。CustomerTwoFactorAuthService::isAuthed():認証方式が未設定の会員は false を返す(!$x === nullの演算子優先順位の修正)CustomerTwoFactorAuthListener::onLoginSuccess():選択した認証方式が無効のときにログアウトへリダイレクトする(従来は戻り値が捨てられて効いていなかった)
@dotani1111 先のコメントで別 Issue とされた「ページ管理で編集したテンプレートが反映されない」件は、本 PR の #[Template] 変更が原因だったため、インラインで本 PR での修正をお願いしました(App・SMS も同様)。別 Issue は不要です。
| tar cvzf ../${{ github.event.repository.name }}-${{ github.event.release.tag_name }}.tar.gz ./* | ||
| - name: Upload binaries to release of TGZ | ||
| uses: svenstaro/upload-release-action@v2 | ||
| uses: svenstaro/upload-release-action@v1-release |
There was a problem hiding this comment.
svenstaro/upload-release-action が @v2 から @v1-release に戻っています(f574c25「v2に更新」の巻き戻し)。意図した変更でなければ @v2 に戻してください。
| uses: svenstaro/upload-release-action@v1-release | |
| uses: svenstaro/upload-release-action@v2 |
| * @return array<string, mixed>|RedirectResponse | ||
| */ | ||
| #[Route(path: '/two_factor_auth/device_auth/input_onetime/{secret_key}', name: 'plg_customer_2fa_device_auth_input_onetime', requirements: ['secret_key' => '^[a-zA-Z0-9]+$'], methods: ['GET', 'POST'])] | ||
| #[Template('@TwoFactorAuthCustomer44/default/device_auth/input.twig')] |
There was a problem hiding this comment.
@TwoFactorAuthCustomer44/... 形式にしたため、テンプレートが app/template/plugin/{code} → プラグインの Resource/template の順で解決され、app/template/{theme} は見なくなります。その結果、copyTwigFiles() が配置するコピーと、ページ管理(dtb_page.file_name は旧形式のまま)での編集が画面に反映されません。店頭画面は従来どおり TwoFactorAuthCustomer44/Resource/template/default/... のパス形式で指定してください(L136、TwoFactorAuthCustomerController.php:49 も同様)。
|
|
||
| // ワンタイムトークン送信メッセージをレンダリング | ||
| $twig = 'TwoFactorAuthCustomer42/Resource/template/default/sms/onetime_message.twig'; | ||
| $twig = '@TwoFactorAuthCustomer44/default/sms/onetime_message.twig'; |
There was a problem hiding this comment.
SMS 本文のテンプレートも @TwoFactorAuthCustomer44/... 形式のため、こちらの指摘と同じ理由で、copyTwigFiles() が app/template/{theme} に配置したコピーを見ません。
コピーを編集しても、送信される SMS の本文には反映されません。
L58・L136 と同様に、パス形式で指定してください。
| $twig = '@TwoFactorAuthCustomer44/default/sms/onetime_message.twig'; | |
| $twig = 'TwoFactorAuthCustomer44/Resource/template/default/sms/onetime_message.twig'; |
|
@KenTanaka |
- @TwoFactorAuthCustomer44 名前空間は app/template/plugin/{code} とプラグインの Resource/template しか探索しないため、copyTwigFiles() が app/template/{theme} に配置したコピーとページ管理での編集が反映されない
- パス形式は twig の既定パス(app/template/{theme} が先頭)で解決されるため、テーマ側のコピーが優先される
- 管理画面のテンプレートはコピー対象外のため名前空間形式のままとする
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- e2e-testing.yml は EC-CUBE 4.2 の Codeception を PHP 8.0 で実行する構成で、4.4 専用の本プラグインでは動作しない - ab-testing.yml は 4.4 本体に存在しない docker-compose.bench.*.yml を参照しており動作しない - いずれも本体の回帰確認・性能比較用で、プラグイン自体の検証は main.yml の CI が担う Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- isAuthed(): 認証方式が未設定の会員は、有効な認証済みクッキーがあっても false を返す。設定済みなら true を返すことも併せて確認し、常に false で通るテストにならないようにする - onLoginSuccess(): 選択中の認証方式が無効ならログアウトへリダイレクトし、有効ならしない。auth() にも無効な方式でログアウトへ飛ばす経路があるため、hasActiveType() を false にしてその経路へ進ませず、呼び出し回数でログアウト判定を通過したかを確かめる - EccubeTestCase の tearDown がプロパティへ null を代入するため、テストのプロパティは nullable にする Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
概要
会員向け2段階認証プラグインを EC-CUBE 4.4(Symfony 7.4 / Doctrine ORM 3.0 / PHP 8.2+) に対応させ、コードを
TwoFactorAuthCustomer42→TwoFactorAuthCustomer44に改名します。4.3 とは非互換(属性必須・ORM 3・PHP 8.2+)のため、新規4.4ブランチへの取り込みです。参考: 4.3→4.4 マイグレーション手順 (doc #346) / 参照 Recommend-plugin #67
変更内容
1. EC-CUBE 4.4 対応(コア移行)
@ORM\*→#[ORM\*]、Controller の@Route/@Template→#[Route]/#[Template](Sensio依存除去)?int/?string/?\DateTime等)、ゲッター/セッター・各メソッドの戻り値型flush($entity)→flush()、QueryBuilder のsetParameters([...])→setParameter()へ変更(型付きパラメータ対応)enable/disableほか関連メソッドに: void@TwoFactorAuthCustomer44/...エイリアスへ統一phpunit.xml.distを<source>/<extensions>形式へ、Tests/bootstrap.phpを追加code/version: 4.4.0/ 管理画面ルートをTwoFactorAuthCustomer44に統一2. 静的解析・整形ツール
phpstan.neon.dist(level 6)/Resource/rector.php/Resource/.php-cs-fixer.dist.phpを追加(.php設定は本体のPlugin\:サービス検出で 500 を避けるためResource/配下に配置)3. CI(
.github/workflows/main.ymlほか)checkout@v4・$GITHUB_OUTPUT化(MySQL 5.7・4.2/4.3 対象は除外)eccube:plugin:install --path=...に変更(mock-package-api 依存を除去)し、PHPUnit 実行ステップを追加--ignore-platform-req=ext-redis: Symfony 7.4 のsymfony/cacheが古いphp-redisと衝突して本体 composer install が失敗するのを回避(redis は未使用)cache:warmup: 有効プラグインのルートはコンテナのコンパイル時に確定するため、phpunit プロセスの遅延コンパイルだとRouteNotFoundExceptionが断続的に発生する問題を解消e2e-testing.yml/ab-testing.yml: 関連プラグインコードを*44(Customer / App / Sms)に更新release.yml: 配布パッケージから開発・テスト用ファイル(docker-compose / dockerbuild / CLAUDE.md / phpstan / rector / php-cs-fixer)を除外テスト
release.yml相当)から開発用ファイルが除外されることを確認