Skip to content

Give testset a name#2300

Merged
TomasVotruba merged 2 commits intorectorphp:masterfrom
jeroensmit:testsetnaming
Nov 12, 2019
Merged

Give testset a name#2300
TomasVotruba merged 2 commits intorectorphp:masterfrom
jeroensmit:testsetnaming

Conversation

@jeroensmit
Copy link
Copy Markdown
Contributor

No description provided.

@TomasVotruba
Copy link
Copy Markdown
Member

What's the reason behind this?

@jeroensmit
Copy link
Copy Markdown
Contributor Author

Is easier to spot which example file is causing exceptions

PHPunit output:

before change:
Rector\DeadCode\Tests\Rector\Class_\RemoveSetterOnlyPropertyAndMethodCallRector\RemoveSetterOnlyPropertyAndMethodCallRectorTest::test with data set #0

after change:
Rector\DeadCode\Tests\Rector\Class_\RemoveSetterOnlyPropertyAndMethodCallRector\RemoveSetterOnlyPropertyAndMethodCallRectorTest::test with data set "deal_with_property_fetches.php.inc"

@TomasVotruba
Copy link
Copy Markdown
Member

TomasVotruba commented Nov 9, 2019

How would you re-run only the specific file without re-typing filename? E.g. there are many files like skip_*

@jeroensmit
Copy link
Copy Markdown
Contributor Author

the complete name filter filters on looks something like:
Rector\Architecture\Tests\Rector\Class_\ConstructorInjectionToActionInjectionRector\ConstructorInjectionToActionInjectionRectorTest::test with data set "duplicate.php.inc"

The filter option works as an regex so you could do:

vendor/bin/phpunit --filter ConstructorInjectionToAction.*duplicate

or

vendor/bin/phpunit --filter ConstructorInjectionToAction --filter duplicate

a part of the file names suffices (doesn't need to be from te start)

@TomasVotruba
Copy link
Copy Markdown
Member

TomasVotruba commented Nov 10, 2019

How would you compare it to --filter test#1?

@TomasVotruba
Copy link
Copy Markdown
Member

TomasVotruba commented Nov 10, 2019

Having both options would be something I'd merge:

Rector\DeadCode\Tests\Rector\Class_\RemoveSetterOnlyPropertyAndMethodCallRector\
...RemoveSetterOnlyPropertyAndMethodCallRectorTest::test with 
...data set #0 - "deal_with_property_fetches.php.inc"

@jeroensmit
Copy link
Copy Markdown
Contributor Author

Just what I was thinking.

Sadly the best thing I can reach is this:

vendor/bin/phpunit --filter RemoveSetter@1.*

If you find that sufficient I'll update the pullrequest.
Otherwise decline. I can live with that ;-)

@TomasVotruba
Copy link
Copy Markdown
Member

Yes, that's what I meant :) go for it

foreach ($fileInfos as $fileInfo) {
yield $fileInfo->getFilename() => [$fileInfo->getPathName()];
yield "{$key} " . $fileInfo->getFilename() => [$fileInfo->getPathName()];
$key++;
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Why not use key of this foreach?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

key contains the filepath

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Ah, I used FinderSanitizer to remove this WTF

Ok

@TomasVotruba TomasVotruba merged commit 68f53b3 into rectorphp:master Nov 12, 2019
@TomasVotruba
Copy link
Copy Markdown
Member

Thank you

@TomasVotruba
Copy link
Copy Markdown
Member

TomasVotruba commented Nov 14, 2019

I'm finally testing it an it breaks filtering by provider key test#1 :/

vendor/bin/phpunit packages/.../RectorTest.php --filter test#1 

@jeroensmit
Copy link
Copy Markdown
Contributor Author

Sorry for taking a while.

Hopefully you managed by now, if not the solution was using @ instead of #
test@1.*

TomasVotruba added a commit that referenced this pull request May 12, 2022
rectorphp/rector-src@e88903f [Core] Improve UnreachableStmtAnalyzer: verify itself by recursive call (#2300)
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.

2 participants