Argument count error in PHPUnit test with data provider and depends attribute
Dieses Issue hat noch niemand übernommen.
Bewertung
- Schwierigkeit
- 3/5
- Geschätzter Aufwand
- 1-2 Tage
- Anfängerfreundlichkeit
- 35/100
- Issue-Typ
- Bug
- Klarheit
- Größtenteils klar
- Aktivitätsstatus
- Veraltet
- Tech-Stack
- php
- Bereich
- testing-qa
Rechercherichtung
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.
Vom Indexierungsmodell aus dem Issue-Text verfasst.
Beschreibung
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 😁
- Vorherrschende Sprache
- PHP
- Sterne
- 544
- Forks
- 58
- Ø Merge
- 2 T. 1 Std.
- Gemergte PRs (30 T.)
- 5
Beitragsleitfaden
Für dieses Repository ist kein Beitragsleitfaden indexiert
Erste Schritte
- Lesen Sie das ganze Issue und danach den Beitragsleitfaden des Projekts.
- Schreiben Sie ins Issue, dass Sie es übernehmen — das erspart doppelte Arbeit.
- Forken Sie das Repository und arbeiten Sie in einem Branch.
- Öffnen Sie einen Pull Request, der die Issue-Nummer nennt.
Mehr aus phpstan/phpstan-phpunit
-
bug
Schwierigkeit 3/5 1-2 Tage Anfängerfreundlichkeit 68/100
phpstan/phpstan-phpunit#332 · 2 Kommentare ·
-
Schwierigkeit 4/5 3-5 Tage Anfängerfreundlichkeit 48/100
phpstan/phpstan-phpunit#321 ·
-
Schwierigkeit 4/5 3-5 Tage Anfängerfreundlichkeit 48/100
phpstan/phpstan-phpunit#309 ·
-
Schwierigkeit 3/5 1-2 Tage Anfängerfreundlichkeit 45/100
phpstan/phpstan-phpunit#299 · 2 Kommentare ·
-
Schwierigkeit 3/5 1-2 Tage Anfängerfreundlichkeit 52/100
phpstan/phpstan-phpunit#292 · 3 Kommentare ·
Alle Issues in phpstan/phpstan-phpunit
Ähnliche Issues
-
Bug
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 70/100
Automattic/safe-publish#594 ·
-
needs-triage Platform(Default)
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 75/100
-
HttpClient
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 75/100
symfony/symfony-docs#23092 ·
-
sync-en
Schwierigkeit 1/5 Unter einer Stunde Anfängerfreundlichkeit 90/100
-
sync-en
Schwierigkeit 1/5 Unter einer Stunde Anfängerfreundlichkeit 95/100