Refactor most ServiceContainer references #2404
Draft
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
The CDash Service Container was introduced to enable white-box unit testing for individual methods without needing a full environment to be set up. This approach has since been superseded by Laravel feature tests and Cypress tests as the preferred means of testing CDash. The excessive use of mocking in the CDash test suite has caused various portions of the test suite to diverge from the true behavior of CDash. There is a time and place for mocks, particularly for error conditions which cannot otherwise be reproduced, but the excessive use of mocking is a long-term liability.
While the goal is to eventually remove all of the service container logic, doing so immediately would decrease our test coverage by an unacceptable amount. This PR removes as much service container logic as possible while maintaining the majority of tests which need it. Importantly, this change allows our static analysis tools to perform more a more complete analysis since concrete types can be directly inferred in more places. As further refactoring work progresses, I expect the remaining service container logic to gradually become obsolete, rendering it possible to remove it in the future.