Argument count error in PHPUnit test with data provider and depends attribute
Personne n'a encore pris cette issue.
Évaluation
- Difficulté
- 3/5
- Temps estimé
- 1-2 jours
- Accessibilité débutants
- 35/100
- Type d'issue
- Bug
- Clarté
- Plutôt claire
- Activité
- À l'abandon
- Stack technique
- php
- Domaine
- testing-qa
Piste de recherche
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.
Rédigé par le modèle d'indexation à partir du texte de l'issue.
Description
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 😁
- Langage dominant
- PHP
- Étoiles
- 544
- Forks
- 58
- Merge moyen
- 2 j 1 h
- PR mergées (30 j)
- 5
Guide de contribution
Aucun guide de contribution indexé pour ce dépôt
Par où commencer
- Lisez l'issue en entier, puis le guide de contribution du projet.
- Signalez en commentaire que vous la prenez — cela évite que deux personnes fassent le même travail.
- Forkez le dépôt et travaillez sur une branche.
- Ouvrez une pull request qui référence le numéro de l'issue.
Autres issues de phpstan/phpstan-phpunit
-
bug
Difficulté 3/5 1-2 jours Accessibilité débutants 68/100
phpstan/phpstan-phpunit#332 · 2 commentaires ·
-
Difficulté 4/5 3-5 jours Accessibilité débutants 48/100
phpstan/phpstan-phpunit#321 ·
-
Difficulté 4/5 3-5 jours Accessibilité débutants 48/100
phpstan/phpstan-phpunit#309 ·
-
Difficulté 3/5 1-2 jours Accessibilité débutants 45/100
phpstan/phpstan-phpunit#299 · 2 commentaires ·
-
Difficulté 3/5 1-2 jours Accessibilité débutants 52/100
phpstan/phpstan-phpunit#292 · 3 commentaires ·
Toutes les issues de phpstan/phpstan-phpunit
Issues similaires
-
tooling
Difficulté 2/5 1-3 heures Accessibilité débutants 75/100
-
UX
Difficulté 2/5 1-3 heures Accessibilité débutants 70/100
ProfessionalWiki/NeoWiki#1525 ·
-
Difficulté 2/5 1-3 heures Accessibilité débutants 75/100
-
bug customer-reported
Difficulté 2/5 1-3 heures Accessibilité débutants 65/100
MagnaCapax/PMSS#949 ·
-
responsive-media kses allow-list strips clipPathUnits, collapsing objectBoundingBox clip paths Ouverte
Difficulté 2/5 1-3 heures Accessibilité débutants 84/100
Automattic/static-site-importer#1829 ·