Hacktoberfest 2026:メンテナが10月に向けて印を付けた、オープンで初心者向けの issue。 Hacktoberfest の issue を見る

Argument count error in PHPUnit test with data provider and depends attribute

オープン
#286 コメント 3 件 リアクション 0 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

評価

難易度
3/5
見積もり時間
1〜2日
初心者へのやさしさ
35/100
issue の種類
バグ
明瞭さ
おおむね明確
活発さ
停滞
技術スタック
php
領域
testing-qa

調査の方向性

Start by reproducing the issue with the shown testSearch method, its Depends and DataProvider attributes, and providerSearchCases generator. Trace how the extension combines dependent-test arguments with data-provider arguments, then verify that the valid four-parameter method produces no arguments.count diagnostic. No repository file or existing test is named in the issue.

索引モデルが issue の本文から書いたものです。

説明

Bug report

hey there 👋

I think I found an issue within PHPUnit tests, using the Depends and DataProvider attribute on the same test method.

    public function testIndexing(): IdsCollection
    {
        $ids = new IdsCollection();
        // ...

        return $ids;
    }

    /**
     * @param list<string> $config
     * @param list<string> $expectedProducts
     */
    #[Depends('testIndexing')]
    #[DataProvider('providerSearchCases')]
    public function testSearch(array $config, string $term, array $expectedProducts, IdsCollection $ids): void
    {
        // ...
    }

    /**
     * @return \Generator<string, array{list<string>, string, list<string>}>
     */
    public static function providerSearchCases(): \Generator
    {
        yield 'search for manufacturer' => [
            ['name', 'description', 'customSearchKeywords', 'manufacturer.name'],
            'Shopware',
            ['product-4'],
        ];

        // and more
    }

error:

Method Shopware\TestClassName::testSearch() invoked with 3 parameters, 4 required.  
🪪  arguments.count   

Unfortunately I cannot provide a playground code snippet, as PHPUnit is not available there. I also don't know, if this is a problem of the PHPUnit extension.

Expected output

no error

Did PHPStan help you today? Did it make you happy in any way?

PHPStan helps me everyday to be the last stand against AI slop 😁

主要言語
PHP
スター
544
フォーク
58
平均マージ
2日 1時間
マージ済み PR(30日)
5

コントリビューションガイド

このリポジトリのコントリビューションガイドは索引されていません

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

phpstan/phpstan-phpunit のほかの issue

phpstan/phpstan-phpunit の issue をすべて見る

似ている issue

PHP の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。