Skip to content
This repository was archived by the owner on Dec 9, 2025. It is now read-only.

Improve test coverage#554

Merged
andrewmile merged 74 commits intodevelopfrom
ajm/improve-test-coverage
Apr 4, 2025
Merged

Improve test coverage#554
andrewmile merged 74 commits intodevelopfrom
ajm/improve-test-coverage

Conversation

@andrewmile
Copy link
Contributor

This PR increases Symposium's test coverage to 100%. This adds a safety net, both for future PRs and for introducing PHPStan into the codebase. Outside of the additional tests themselves, the following notable changes were made:

  • Inaccessible code paths and unused methods have been removed
  • The TweetImportantCFPDates command has been removed
  • App functionality required by Laravel or another package has been ignored in the code coverage report with a @codeCoverageIgnore annotation
image

Andrew Morgan added 30 commits June 7, 2024 14:39
@andrewmile andrewmile requested a review from mattstauffer March 21, 2025 15:34
@andrewmile andrewmile self-assigned this Mar 21, 2025
@andrewmile andrewmile changed the title Ajm/improve test coverage Improve test coverage Mar 21, 2025
Copy link
Contributor

@mattstauffer mattstauffer left a comment

Choose a reason for hiding this comment

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

I'm not going to lie, I only skimmed the tests, because there's so much there. LMK if you'd like me to really go through them more in depth. Great work here, really an incredible amount of work!


public function subscribe($events)
{
if (empty(config('app.slack_endpoint')) || App::environment('testing')) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Is this no longer a concern, where this would throw an error in tests and if someone hadn't set up Slack?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is handled by calling Notification::fake() in the base TestCase. Not returning early in the subscriber then allows for testing that a notification was sent via a call to Notification::assertSentToTightenSlack(NewConference::class);.

Copy link
Contributor

Choose a reason for hiding this comment

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

OK, that makes sense for the testing environment check, but what about people installing this locally who don't have a Slack endpoint setup?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I hadn't thought of that, but I think I have come to a good solution. This commit overrides the slack notification channel when the endpoint isn't set, and will log the notification instead of sending it.

The above allows the test suite to cover the whole feature flow without affecting users running the app locally. This also has the added benefit of being able to inspect the notification in the log.

@mattstauffer
Copy link
Contributor

@andrewmile Note.. i asked a bunch of "are we just not using this anymore" questions, but then saw your note about "Inaccessible code paths and unused methods have been removed"... so i guess we're not using all that code lol 🤷

@andrewmile andrewmile requested a review from mattstauffer March 28, 2025 17:08
@andrewmile andrewmile merged commit 4ac1141 into develop Apr 4, 2025
2 checks passed
@andrewmile andrewmile deleted the ajm/improve-test-coverage branch April 4, 2025 16:02
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2 participants