sebastianbergmann / phpunit

The PHP Unit Testing framework.
https://phpunit.de/
BSD 3-Clause "New" or "Revised" License
19.6k stars 2.19k forks source link

test not discovered, where @dataProvider is above it #5480

Closed e-rasekh closed 10 months ago

e-rasekh commented 10 months ago
Q A
PHPUnit version 10.3.1
PHP version 8.1
Installation Method Composer

Summary

I wrote a test by a dataProvider and everything was true. but I need another test by another dataProvider in the same class. and when I wrote the 2nd dataProvider, every thing goes to confusing me.

Current behavior

my first test, is not found! even in php artisan test --list-tests if I remove dataProvider annotation, test will be find.

composer info | sort bensampo/laravel-enum v6.6.2 Simple, extensible and powerful enumeration implementation for Laravel. brianium/paratest v7.2.5 Parallel testing for PHP brick/math 0.11.0 Arbitrary-precision arithmetic library composer/class-map-generator 1.1.0 Utilities to scan PHP code and generate class maps. composer/pcre 3.1.0 PCRE wrapping library that offers type-safe preg_* replacements. dflydev/dot-access-data v3.0.2 Given a deep data structure, access data by dot notation. doctrine/cache 2.2.0 PHP Doctrine Cache library is a popular cache implementation that supports many different drivers such as redis, memcache, apc, mongo...
doctrine/dbal 3.6.5 Powerful PHP database abstraction layer (DBAL) with many features for database schema introspection and management. doctrine/deprecations v1.1.1 A small layer on top of trigger_error(E_USER_DEPRECATED) or PSR-3 logging with options to disable all deprecations or selectively for...
doctrine/event-manager 2.0.0 The Doctrine Event Manager is a simple PHP event system that was built to be used with the various Doctrine projects. doctrine/inflector 2.0.8 PHP Doctrine Inflector is a small library that can perform string manipulations with regard to upper/lowercase and singular/plural fo...
doctrine/lexer 3.0.0 PHP Doctrine Lexer parser library that can be used in Top-Down, Recursive Descent Parsers. dragonmantank/cron-expression v3.3.3 CRON for PHP: Calculate the next or previous run date and determine if a CRON expression is due egulias/email-validator 4.0.1 A library for validating emails against several RFCs fakerphp/faker v1.23.0 Faker is a PHP library that generates fake data for you. fidry/cpu-core-counter 0.5.1 Tiny utility to get the number of CPU cores. filp/whoops 2.15.3 php error handling for cool kids fruitcake/php-cors v1.2.0 Cross-origin resource sharing library for the Symfony HttpFoundation graham-campbell/result-type v1.1.1 An Implementation Of The Result Type guzzlehttp/guzzle 7.7.0 Guzzle is a PHP HTTP client library guzzlehttp/promises 2.0.1 Guzzle promises library guzzlehttp/psr7 2.6.0 PSR-7 message implementation that also provides common utility methods guzzlehttp/uri-template v1.0.1 A polyfill class for uri_template of PHP hamcrest/hamcrest-php v2.0.1 This is the PHP port of Hamcrest Matchers jean85/pretty-package-versions 2.0.5 A library to get pretty versions strings of installed dependencies laminas/laminas-code 4.11.0 Extensions to the PHP Reflection API, static code scanning, and code generation laravel/breeze v1.23.0 Minimal Laravel authentication scaffolding with Blade and Tailwind. laravel/framework v10.18.0 The Laravel Framework. laravel/pint v1.10.6 An opinionated code formatter for PHP. laravel/prompts v0.1.4 laravel/sail v1.23.2 Docker files for running a basic Laravel application. laravel/sanctum v3.2.5 Laravel Sanctum provides a featherweight authentication system for SPAs and simple APIs. laravel/serializable-closure v1.3.1 Laravel Serializable Closure provides an easy and secure way to serialize closures in PHP. laravel/tinker v2.8.1 Powerful REPL for the Laravel framework. league/commonmark 2.4.0 Highly-extensible PHP Markdown parser which fully supports the CommonMark spec and GitHub-Flavored Markdown (GFM) league/config v1.2.0 Define configuration arrays with strict schemas and access values with dot notation league/flysystem 3.15.1 File storage abstraction for PHP league/flysystem-local 3.15.0 Local filesystem adapter for Flysystem. league/mime-type-detection 1.13.0 Mime-type detection for Flysystem mattiasgeniar/phpunit-query-count-assertions 1.1.2 A custom assertion for phpunit that allows you to count the amount of SQL queries used in a test. Can be used to enforce certain perf...
mockery/mockery 1.6.6 Mockery is a simple yet flexible PHP mock object framework monolog/monolog 3.4.0 Sends your logs to files, sockets, inboxes, databases and various web services myclabs/deep-copy 1.11.1 Create deep copies (clones) of your objects nesbot/carbon 2.68.1 An API extension for DateTime that supports 281 different languages. nette/schema v1.2.4 📐 Nette Schema: validating data structures against a given Schema. nette/utils v4.0.1 🛠 Nette Utils: lightweight utilities for string & array manipulation, image handling, safe JSON encoding/decoding, validation, sl...
nikic/php-parser v4.16.0 A PHP parser written in PHP nunomaduro/collision v7.8.1 Cli error handling for console/command-line PHP applications. nunomaduro/termwind v1.15.1 Its like Tailwind CSS, but for the console. phar-io/manifest 2.0.3 Component for reading phar.io manifest information from a PHP Archive (PHAR) phar-io/version 3.2.1 Library for handling version information and constraints phpoption/phpoption 1.9.1 Option Type for PHP phpunit/php-code-coverage 10.1.3 Library that provides collection, processing, and rendering functionality for PHP code coverage information. phpunit/php-file-iterator 4.0.2 FilterIterator implementation that filters files based on a list of suffixes. phpunit/php-invoker 4.0.0 Invoke callables with a timeout phpunit/php-text-template 3.0.0 Simple template engine. phpunit/php-timer 6.0.0 Utility class for timing phpunit/phpunit 10.3.1 The PHP Unit Testing framework. psr/cache 3.0.0 Common interface for caching libraries psr/container 2.0.2 Common Container Interface (PHP FIG PSR-11) psr/event-dispatcher 1.0.0 Standard interfaces for event handling. psr/http-client 1.0.2 Common interface for HTTP clients psr/http-factory 1.0.2 Common interfaces for PSR-7 HTTP message factories psr/http-message 2.0 Common interface for HTTP messages psr/log 3.0.0 Common interface for logging libraries psr/simple-cache 3.0.0 Common interfaces for simple caching psy/psysh v0.11.20 An interactive shell for modern PHP. ralouphie/getallheaders 3.0.3 A polyfill for getallheaders. ramsey/collection 2.0.0 A PHP library for representing and manipulating collections. ramsey/uuid 4.7.4 A PHP library for generating and working with universally unique identifiers (UUIDs). realrashid/sweet-alert v7.1.0 Laravel Sweet Alert Is A Package For Laravel Provides An Easy Way To Display Alert Messages Using The SweetAlert2 Library. sebastian/cli-parser 2.0.0 Library for parsing CLI options sebastian/code-unit 2.0.0 Collection of value objects that represent the PHP code units sebastian/code-unit-reverse-lookup 3.0.0 Looks up which function or method a line of code belongs to sebastian/comparator 5.0.0 Provides the functionality to compare PHP values for equality sebastian/complexity 3.0.0 Library for calculating the complexity of PHP code units sebastian/diff 5.0.3 Diff implementation sebastian/environment 6.0.1 Provides functionality to handle HHVM/PHP environments sebastian/exporter 5.0.0 Provides the functionality to export PHP variables for visualization sebastian/global-state 6.0.1 Snapshotting of global state sebastian/lines-of-code 2.0.0 Library for counting the lines of code in PHP source code sebastian/object-enumerator 5.0.0 Traverses array structures and object graphs to enumerate all referenced objects sebastian/object-reflector 3.0.0 Allows reflection of object attributes, including inherited and non-public ones sebastian/recursion-context 5.0.0 Provides functionality to recursively process PHP variables sebastian/type 4.0.0 Collection of value objects that represent the types of the PHP type system sebastian/version 4.0.1 Library that helps with managing the version number of Git-hosted PHP projects spatie/backtrace 1.5.3 A better backtrace spatie/flare-client-php 1.4.2 Send PHP errors to Flare spatie/ignition 1.9.0 A beautiful error page for PHP applications. spatie/laravel-ignition 2.2.0 A beautiful error page for Laravel applications. symfony/console v6.3.2 Eases the creation of beautiful and testable command line interfaces symfony/css-selector v6.3.2 Converts CSS selectors to XPath expressions symfony/deprecation-contracts v3.3.0 A generic function and convention to trigger deprecation notices symfony/error-handler v6.3.2 Provides tools to manage errors and ease debugging PHP code symfony/event-dispatcher v6.3.2 Provides tools that allow your application components to communicate with each other by dispatching events and listening to them symfony/event-dispatcher-contracts v3.3.0 Generic abstractions related to dispatching event symfony/finder v6.3.3 Finds files and directories via an intuitive fluent interface symfony/http-client v6.3.2 Provides powerful methods to fetch HTTP resources synchronously or asynchronously symfony/http-client-contracts v3.3.0 Generic abstractions related to HTTP clients symfony/http-foundation v6.3.2 Defines an object-oriented layer for the HTTP specification symfony/http-kernel v6.3.3 Provides a structured process for converting a Request into a Response symfony/mailer v6.3.0 Helps sending emails symfony/mailgun-mailer v6.3.2 Symfony Mailgun Mailer Bridge symfony/mime v6.3.3 Allows manipulating MIME messages symfony/polyfill-ctype v1.27.0 Symfony polyfill for ctype functions symfony/polyfill-intl-grapheme v1.27.0 Symfony polyfill for intl's grapheme_* functions symfony/polyfill-intl-idn v1.27.0 Symfony polyfill for intl's idn_to_ascii and idn_to_utf8 functions symfony/polyfill-intl-normalizer v1.27.0 Symfony polyfill for intl's Normalizer class and related functions symfony/polyfill-mbstring v1.27.0 Symfony polyfill for the Mbstring extension symfony/polyfill-php72 v1.27.0 Symfony polyfill backporting some PHP 7.2+ features to lower PHP versions symfony/polyfill-php80 v1.27.0 Symfony polyfill backporting some PHP 8.0+ features to lower PHP versions symfony/polyfill-php83 v1.27.0 Symfony polyfill backporting some PHP 8.3+ features to lower PHP versions symfony/polyfill-uuid v1.27.0 Symfony polyfill for uuid functions symfony/process v6.3.2 Executes commands in sub-processes symfony/routing v6.3.3 Maps an HTTP request to a set of configuration variables symfony/service-contracts v3.3.0 Generic abstractions related to writing services symfony/string v6.3.2 Provides an object-oriented API to strings and deals with bytes, UTF-8 code points and grapheme clusters in a unified way symfony/translation v6.3.3 Provides tools to internationalize your application symfony/translation-contracts v3.3.0 Generic abstractions related to translation symfony/uid v6.3.0 Provides an object-oriented API to generate and represent UIDs symfony/var-dumper v6.3.3 Provides mechanisms for walking through any arbitrary PHP variable symfony/yaml v6.3.3 Loads and dumps YAML files theseer/tokenizer 1.2.1 A small library for converting tokenized PHP source code into XML and potentially other formats tijsverkoyen/css-to-inline-styles 2.2.6 CssToInlineStyles is a class that enables you to convert HTML-pages/files into HTML-pages/files with inline styles. This is very usef...
vlucas/phpdotenv v5.5.0 Loads environment variables from .env to getenv(), $_ENV and $_SERVER automagically. voku/portable-ascii 2.0.1 Portable ASCII library - performance optimized (ascii) string functions for php. webmozart/assert 1.11.0 Assertions to validate method input/output with nice error messages.

sebastianbergmann commented 10 months ago

Thank you for your report.

Please provide a minimal, self-contained, reproducing test case that shows the problem you are reporting.

Without such a minimal, self-contained, reproducing test case I will not be able to investigate this issue.

e-rasekh commented 10 months ago

oh sorry, I forgot to attach my code. right now, I wanted to copy my code and paste here, then I found a key for a yield, is duplicate. when I remove duplicate keys, my test has been found. Is it a bug? I think it's better to throw an error that yield names is duplicate, not 'test not found' .

thanks in advanced.

sample small code :

` /**

e-rasekh commented 10 months ago

just one question, in 'new issues' , is it necessary to write all output of the 'composer info | sort' command? it is too long in my post, yes?

sebastianbergmann commented 10 months ago

Your reproducing test case is not self-contained.

e-rasekh commented 10 months ago

oh/ I'm nobe on github forums. I don't know what should I do exactly.

sebastianbergmann commented 10 months ago

Probably a duplicate of #4884.

e-rasekh commented 10 months ago

oh yes, thanks.