-
-
Notifications
You must be signed in to change notification settings - Fork 411
Use yieldDirectoryExclusivelyWithRelativePathname to allow filter by filename #2356
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
Conversation
Does the number filter still works? |
What you mean with number filter? |
@alexander-schranz something like this: vendor/bin/phpunit rules-tests/TypeDeclaration/Rector/ClassMethod/AddArrayReturnDocTypeRector/AddArrayReturnDocTypeRectorTest.php --filter=#1
PHPUnit 9.5.20 #StandWithUkraine
. 1 / 1 (100%)
Time: 00:00.772, Memory: 64.50 MB
OK (1 test, 2 assertions) I tried locally, and after apply your change, it seems cause empty result: ➜ rector-src git:(main) vendor/bin/phpunit rules-tests/TypeDeclaration/Rector/ClassMethod/AddArrayReturnDocTypeRector/AddArrayReturnDocTypeRectorTest.php --filter=#1
PHPUnit 9.5.20 #StandWithUkraine
No tests executed! so it make number filter no longer working. |
Is that really required? I mean you normally don't know the number of the test but you see in your IDE the filename of the test. But we could still add if required |
I usually doing that if found a numbered fixture error to just know the number of fixture, eg: vendor/bin/phpunit rules-tests/TypeDeclaration/Rector/ClassMethod/AddArrayReturnDocTypeRector/AddArrayReturnDocTypeRectorTest.php
PHPUnit 9.5.20 #StandWithUkraine
................................F................................ 65 / 67 ( 97%)
.. 67 / 67 (100%)
Time: 00:04.125, Memory: 132.50 MB
There was 1 failure:
1) Rector\Tests\TypeDeclaration\Rector\ClassMethod\AddArrayReturnDocTypeRector\AddArrayReturnDocTypeRectorTest::test with data set #28 (Symplify\SmartFileSystem\SmartFileInfo Object (...))
rules-tests/TypeDeclaration/Rector/ClassMethod/AddArrayReturnDocTypeRector/Fixture/fixture.php.inc
Failed asserting that string matches format description.
--- Expected
+++ Actual
@@ @@
/**
* @return int[]
*/
- public function getValues(): array
+ public function getValues() above, I can see that there is error in fixture number vendor/bin/phpunit rules-tests/TypeDeclaration/Rector/ClassMethod/AddArrayReturnDocTypeRector/AddArrayReturnDocTypeRectorTest.php --filter=#28
PHPUnit 9.5.20 #StandWithUkraine
F 1 / 1 (100%)
Time: 00:00.675, Memory: 60.50 MB
There was 1 failure:
1) Rector\Tests\TypeDeclaration\Rector\ClassMethod\AddArrayReturnDocTypeRector\AddArrayReturnDocTypeRectorTest::test with data set #28 (Symplify\SmartFileSystem\SmartFileInfo Object (...))
rules-tests/TypeDeclaration/Rector/ClassMethod/AddArrayReturnDocTypeRector/Fixture/fixture.php.inc
Failed asserting that string matches format description.
--- Expected
+++ Actual
@@ @@
/**
* @return int[]
*/
- public function getValues(): array
+ public function getValues() |
But it works the same for the new name instead of |
I think that will make too long to type and can make typo as copy paste in the middle of long name. I think You can extends |
$counter = 0; | ||
foreach (StaticFixtureFinder::yieldDirectoryExclusivelyWithRelativePathname($directory, $suffix) as $name => $parameters) { | ||
yield '#' . $counter . ' ' . $name => $parameters; | ||
|
||
++$counter; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it seems not working:
vendor/bin/phpunit rules-tests/TypeDeclaration/Rector/ClassMethod/AddArrayReturnDocTypeRector/AddArrayReturnDocTypeRectorTest.php --filter=#1
PHPUnit 9.5.20 #StandWithUkraine
No tests executed!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Okay that is really strange seems like some strange phpunit internal behaviour how #
is handled in the filter.
Still thx for your time and feedback.
This way it is possible to use e.g.: