Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support --group in --list-tests #5703

Closed
wants to merge 5 commits into from

Conversation

staabm
Copy link
Contributor

@staabm staabm commented Feb 16, 2024

early submit to get some functional questions answered. I will cleanup CS and type-checker after we have the same idea how the feature should work

closes #5702

foreach (new RecursiveIteratorIterator($this->suite) as $test) {
if ($test instanceof TestCase) {
if (!$this->testContainsConfiguredGroups($test, $configuredGroups)) {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should a PhptTestCase be skipped when groups are passed via CLI flags, since a PhptTestCase cannot define a group (AFAICT) ?

I would skip them - do you agree?

Copy link

codecov bot commented Feb 17, 2024

Codecov Report

Attention: 2 lines in your changes are missing coverage. Please review.

Comparison is base (ef9f635) 89.94% compared to head (cc0d5e9) 89.96%.

Files Patch % Lines
...TextUI/Command/Commands/ListTestsAsTextCommand.php 94.44% 1 Missing ⚠️
.../TextUI/Command/Commands/ListTestsAsXmlCommand.php 94.44% 1 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff              @@
##               main    #5703      +/-   ##
============================================
+ Coverage     89.94%   89.96%   +0.02%     
- Complexity     6460     6474      +14     
============================================
  Files           684      684              
  Lines         19618    19650      +32     
============================================
+ Hits          17645    17679      +34     
+ Misses         1973     1971       -2     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@staabm staabm marked this pull request as ready for review February 17, 2024 10:53
@sebastianbergmann
Copy link
Owner

I wrote down my thoughts on the proposed change in #5702 (comment) and will only comment on the currently proposed implementation here.

If we change options such as --list-tests to apply filters such as --group then we should reuse the existing code (TestSuiteFilterProcessor) to perform the filtering.

After d2003b6, this (c|sh)ould be a simple as

diff --git a/src/TextUI/Application.php b/src/TextUI/Application.php
index 2bf6d3c78..5f2c8bb31 100644
--- a/src/TextUI/Application.php
+++ b/src/TextUI/Application.php
@@ -37,6 +37,7 @@
 use PHPUnit\Runner\Extension\ExtensionBootstrapper;
 use PHPUnit\Runner\Extension\Facade as ExtensionFacade;
 use PHPUnit\Runner\Extension\PharLoader;
+use PHPUnit\Runner\Filter\Factory;
 use PHPUnit\Runner\GarbageCollection\GarbageCollectionHandler;
 use PHPUnit\Runner\ResultCache\DefaultResultCache;
 use PHPUnit\Runner\ResultCache\NullResultCache;
@@ -416,6 +417,8 @@ private function executeCommandsThatDoNotRequireTheTestSuite(Configuration $conf
 
     private function executeCommandsThatRequireTheTestSuite(Configuration $configuration, CliConfiguration $cliConfiguration, TestSuite $testSuite): void
     {
+        (new TestSuiteFilterProcessor(new Factory))->process($configuration, $testSuite);
+
         if ($cliConfiguration->listGroups()) {
             $this->execute(new ListGroupsCommand($testSuite));
         }

@sebastianbergmann
Copy link
Owner

Thank you for your contribution. I appreciate the time you invested in preparing this pull request. However, I have decided not to merge it.

@sebastianbergmann
Copy link
Owner

After d2003b6, this (c|sh)ould be a simple as

Alas, it is not: #5720 (comment). But I'm working on it :)

@staabm staabm deleted the test-list-groups branch March 3, 2024 09:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

combine --list-tests with --group
3 participants