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

Find a cleaner approach to removing unnecessary tests #2

Open
GuySartorelli opened this issue Jun 9, 2022 · 0 comments
Open

Find a cleaner approach to removing unnecessary tests #2

GuySartorelli opened this issue Jun 9, 2022 · 0 comments

Comments

@GuySartorelli
Copy link
Member

There is a section in ci.yml where any file ending with Test.php in a tests directory is deleted.

Remove vendor unit tests files that were installed because of the use of --prefer-source
Some older silverstripe vendor modules may still have the phpunit5 setUp() signatures without :void which when loaded will throw fatal PHP errors.
We cannot simply get rid of the 'tests' folders because behat requires vendor/silverstripe/[framework|cms]/tests/behat/serve-bootstrap.php

There are some hardcoded exceptions to this, though, like any file named ExtendTest.php because:

Make an exception for 'ExtendTest.php' which is a misnamed TestOnly non-test class

Except there are a lot of other classes in the same directory as ExtendTest.php which are also DataObjects and should be similarly excluded.

What's more, the only reason specific files are being targetted like this is apparently:

We cannot simply get rid of the 'tests' folders because behat requires vendor/silverstripe/[framework|cms]/tests/behat/serve-bootstrap.php

The only reason this wasn't done initially is because there was resistance to touch it at that stage since it it took a long time getting this fragile approach working in the first place.

Proposal

According to the above comment, only two files from tests directories actually need to be kept. So instead of going through and deleting all the files with seemingly arbitrary exceptions, we should just delete all of the tests directories, with exception of those in framework and cms, where we should delete all files inside tests except the two we need to keep.

If the above comment is found to be incorrect, at the very least it should be updated, and we should find a more robust way of setting exceptions since the current way seems to be pretty inconsistent with what is or isn't excluded.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant