-
Notifications
You must be signed in to change notification settings - Fork 15
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
Move test directory out of package path #168
Conversation
cc @jrfnl What do you think about this organization? |
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.
Definitely a good step in the right direction. 👍
Next step, IMO, would be to split the VariableAnalysisTest.php
into separate files, linked one-on-one with the fixture files.
Couple of small remarks/questions for this PR:
- Should the
fixtures
directory be under thetests/Sniffs
directory ? Or should theVariableAnalysisTest.php
file possibly not be in aSniffs
subdirectory ?
Having them as "equal" subdirectories seem to create a disconnect in their relation to each other. - As you're changing the
phpcs.xml.dist
ruleset, shouldvendor
be excluded as well ?
Agreed.
Yes, good point. I'm not sure why I had moved it up a level. As for the
👍 One last thing to consider is the test namespace fixed in #164. This leaves that change in place, but I'm not sure if it's still correct. |
Good point, that will need fixing now. Would you like me to guide you through possible solutions or shall I add a commit to this branch with a fix ? |
You're welcome to commit to this branch! |
1. Make the namespace of the `VariableAnalysisTest` file reflect the path the file. 2. Add an `autoload-dev` section to the `composer.json` * The unit tests are not shipped in the distribution package, so they are only available in a `dev` environment, which is exactly what `autoload-dev` is targetting. * Setting the `tests` directory as a secondary path for PSR4 autoload should fix compatibility with Composer 2.
3699e8c
to
4fba748
Compare
Done, the additional commit should fix it. See the commit message for the rationale. There's just one thing left I'm still a bit unsure about: the naming of the Especially with an eye of the test file being split in the future, would it make sense to call the directory That would also allow for additional sniffs - if the sniff would be split or other variable analysis sniffs would be added - to each have their own |
Oh... last thing which just popped up in my mind: should the |
Perfect. Thank you! 👌
Yeah, the directories were just set up to mirror the ones in the source directories, but I don't know why I chose to do that (presumably I was copying an existing structure somewhere). I think
That's a good question. My habit from other packages and languages is to leave everything lowercase unless required, hence |
Well, if it would mirror the
The only reason I can think of, is that having the actual tests in a subdirectory vs the test utility files (base test case + bootstrap) in the Is that enough of a reason ?
I'm thinking more of PSR-4 and the different OSes. The base namespace for the tests is Also - though a PHPCS requirement - the |
Sounds good to me! I'll move it shortly.
Good points, all. Thanks for leading me through the logic there. I'll rename it! |
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.
LGTM 👍
Co-Authored-By: Juliette <[email protected]>
* Move tests directory to top level * Modify tests directory path in other files * Move fixtures back adjacent to tests * Exclude vendor from phpcs * Tests: fix composer autoload 1. Make the namespace of the `VariableAnalysisTest` file reflect the path the file. 2. Add an `autoload-dev` section to the `composer.json` * The unit tests are not shipped in the distribution package, so they are only available in a `dev` environment, which is exactly what `autoload-dev` is targetting. * Setting the `tests` directory as a secondary path for PSR4 autoload should fix compatibility with Composer 2. * Rename tests/Sniffs to tests/VariableAnalysisSniff * Rename tests to Tests * Rename Tests directory paths in files * Rename test namespace to match new path * Update .gitattributes from tests to Tests Co-Authored-By: Juliette <[email protected]> Co-authored-by: jrfnl <[email protected]> Co-authored-by: Juliette <[email protected]>
This moves the tests from
VariableAnalysis/Tests
toTests
.Related to #116 and #162