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

[flutter_test] Adds method to mock EventChannels #123726

Merged
merged 32 commits into from Apr 7, 2023

Conversation

Rexios80
Copy link
Contributor

@Rexios80 Rexios80 commented Mar 29, 2023

Currently there is a way to mock MethodChannels, but no built in way to easily mock EventChannels. This PR adds a setMockStreamHandler method to go along with the existing setMockMethodCallHandler

#26528
#38954

If you had to change anything in the flutter/tests repo, include a link to the migration guide as per the breaking change policy.

Pre-launch Checklist

  • I read the Contributor Guide and followed the process outlined there for submitting PRs.
  • I read the Tree Hygiene wiki page, which explains my responsibilities.
  • I read and followed the Flutter Style Guide, including Features we expect every widget to implement.
  • I signed the CLA.
  • I listed at least one issue that this PR fixes in the description above.
  • I updated/added relevant documentation (doc comments with ///).
  • I added new tests to check the change I am making, or this PR is test-exempt.
  • All existing and new tests are passing.

If you need help, consider asking for advice on the #hackers-new channel on Discord.

@flutter-dashboard flutter-dashboard bot added a: tests "flutter test", flutter_test, or one of our tests framework flutter/packages/flutter repository. See also f: labels. labels Mar 29, 2023
@Rexios80 Rexios80 marked this pull request as ready for review March 29, 2023 23:05
@pdblasi-google pdblasi-google self-requested a review March 31, 2023 21:41
Copy link
Contributor

@pdblasi-google pdblasi-google left a comment

Choose a reason for hiding this comment

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

I really like what you've got here, it cleans things up quite a lot! Just a couple of nits and an API suggestion that I think will improve discoverability.

@Rexios80
Copy link
Contributor Author

Rexios80 commented Apr 6, 2023

@pdblasi-google Should I just keep merging main into this until the Google Testing passes?

@pdblasi-google
Copy link
Contributor

@Rexios80

If this one doesn't work, I'll escalate internally. I've been following a thread on the issues and I think they have been resolved. If you'd like, I have access to the "Update branch" button, so I can follow through on this one 'til it's able to get merged.

@goderbauer
Copy link
Member

The issue should be resolved and Google testing is working again. May require another rebase to trigger it again, though.

@pdblasi-google pdblasi-google added the autosubmit Merge PR when tree becomes green via auto submit App label Apr 6, 2023
@auto-submit auto-submit bot removed the autosubmit Merge PR when tree becomes green via auto submit App label Apr 6, 2023
@auto-submit
Copy link
Contributor

auto-submit bot commented Apr 6, 2023

auto label is removed for flutter/flutter, pr: 123726, due to This PR has not met approval requirements for merging. You have project association NONE and need 1 more review(s) in order to merge this PR.

  • Merge guidelines: You need at least one approved review if you are already a MEMBER or two member reviews if you are not a MEMBER before re-applying the autosubmit label. Reviewers: If you left a comment approving, please use the "approve" review action instead.

@auto-submit
Copy link
Contributor

auto-submit bot commented Apr 6, 2023

auto label is removed for flutter/flutter, pr: 123726, due to Validations Fail.

@Rexios80 Rexios80 requested a review from goderbauer April 7, 2023 01:00
Copy link
Member

@goderbauer goderbauer left a comment

Choose a reason for hiding this comment

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

LGTM

@Rexios80
Copy link
Contributor Author

In case anyone wants to use this code before it's released to stable, I copied this code into the mock_event_channel package. When this PR is released to stable, just remove that package.

exaby73 pushed a commit to NevercodeHQ/flutter that referenced this pull request Apr 17, 2023
[flutter_test] Adds method to mock EventChannels
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
a: tests "flutter test", flutter_test, or one of our tests autosubmit Merge PR when tree becomes green via auto submit App framework flutter/packages/flutter repository. See also f: labels.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants