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

Fix test class name #260

Merged
merged 1 commit into from
Jul 20, 2024
Merged

Fix test class name #260

merged 1 commit into from
Jul 20, 2024

Conversation

szepeviktor
Copy link
Contributor

... so it matched the file name tests/ControlStructures/ForeachControlStructureTest.php

@szepeviktor
Copy link
Contributor Author

A crude tool.

find -type f -name "[A-Z]*.php" | xargs -I% -- bash -c 'grep -q -m1 "^\(class\|abstract class\|final class\|interface\)\? $(basename -s .php %)" "%" || echo "Classname not found: %"'

@spaze
Copy link
Owner

spaze commented Jul 16, 2024

Nice catch, thanks! I think phpcs may be able to find it as well, of configured, possibly using this rule. I'll look into it. [Update: couldn't get this rule to work, nevermind]

@spaze spaze merged commit 0615f65 into spaze:main Jul 20, 2024
37 checks passed
@spaze
Copy link
Owner

spaze commented Jul 20, 2024

Thanks! (Introduced in #257 by not fully removing the original class name from the copy/pasted file)

@szepeviktor
Copy link
Contributor Author

Glad to contribute.

For PSR-4 there is composer dump-autoload --dev --optimize --strict-psr

@szepeviktor szepeviktor deleted the patch-1 branch July 20, 2024 15:23
@spaze
Copy link
Owner

spaze commented Jul 20, 2024

For PSR-4 there is composer dump-autoload --dev --optimize --strict-psr

Cool, though it doesn't seem to detect the case fixed here:

$ composer dump-autoload --dev --optimize --strict-psr
Generating optimized autoload files
Generated optimized autoload files containing 1920 classes
$ echo $?
0
$ grep extends ./tests/ControlStructures/ForeachControlStructureTest.php
class WhilForeachControlStructureTest extends RuleTestCase

@szepeviktor
Copy link
Contributor Author

it doesn't seem to detect the case fixed here:

Of course! Tests are not PSR-4 but "classmap".

@spaze
Copy link
Owner

spaze commented Jul 20, 2024

Ah sorry, I see now what you mean. I thought the "For PSR-4 ..." comment was somehow related to this issue. Turns out, it wasn't, or at least not directly :-)

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