HttpRequestTrait fatals on WordPress 7.2: $blocked_http_requests clashes with WP_UnitTestCase_Base
まだ誰も着手していません。
評価
調査の方向性
$blocked_http_requests プロパティと、src/Integration/HttpRequestTrait.php での使用箇所から始めてください。その後、WordPress の tests/phpunit/includes/abstract-testcase.php にある protected 宣言と比較します。Issue にある5行のスニペットは、WordPress なしで衝突を再現します。trait を使う統合テストが WordPress trunk で読み込まれ、パッケージ自身のテストが引き続き通れば完了です。
索引モデルが issue の本文から書いたものです。
説明
Describe the bug
On WordPress trunk (7.2-alpha), any integration test class that uses HttpRequestTrait fails to load:
PHP Fatal error: WP_UnitTestCase_Base and WPMedia\PHPUnit\Integration\HttpRequestTrait define the same property ($blocked_http_requests) in the composition of … However, the definition differs and is considered incompatible.
Core added its own external-HTTP blocking to the base test case (@since 7.2.0) and used the same property name:
- WordPress,
tests/phpunit/includes/abstract-testcase.php:protected array $blocked_http_requests = array(); - this package,
src/Integration/HttpRequestTrait.php:private $blocked_http_requests = [];
PHP won't compose a trait property that differs from an inherited one.
To Reproduce
- Use wp-media/phpunit v3.3.
- Run any integration test that uses
HttpRequestTraitagainst WordPress trunk (seen on 7.2-alpha-64349). - See the fatal error above.
The same error without WordPress, in five lines:
abstract class Base { protected array $blocked_http_requests = array(); }
trait T { private $blocked_http_requests = []; }
class Test extends Base { use T; }
- 主要言語
- PHP
- スター
- 4
- フォーク
- 2
- PR マージ指標
- 30日以内にマージされた PR はありません
環境構築
このプロジェクトには開発コンテナ、Dockerfile、コントリビューションガイドがありません。まず README を読み、一般的な手順ははじめてのコントリビューションガイドを参照してください。
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
wp-media/phpunit のほかの issue
-
enhancement Made by AI
難易度 3/5 1〜2日 初心者へのやさしさ 68/100
-
enhancement Made by AI
難易度 3/5 1〜2日 初心者へのやさしさ 74/100
-
wpmedia-phpunit binary breaks @runInSeparateProcess tests再び着手できるかも @remyperona が 63 日前に担当しましたが、オープン中のプルリクエストはありません。 オープンbug Made by AI
-
Improve the library to include classes that could be common to all plugins.再び着手できるかも @hellofromahmed が 770 日前に担当しましたが、オープン中のプルリクエストはありません。 オープン
-
AdminOnly causes a Notice: Undefined offset in wordpress-develop vars.再び着手できるかも @hellofromtonya が 2441 日前に担当しましたが、オープン中のプルリクエストはありません。 オープン
wp-media/phpunit の issue をすべて見る
似ている issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
verbb/formie#3033 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
-
[Type] Bug
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
メンテナーはふだん 1 日以内に返信
-
Awaiting Triage enhancement / feature request
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100
メンテナーはふだん 2 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
-
macOS
難易度 2/5 1〜3時間 初心者へのやさしさ 76/100
beyondcode/herd-community#1774 ·