-
Notifications
You must be signed in to change notification settings - Fork 370
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
managers
extends public classes
#3314
Conversation
🚀 Deployed on https://deploy-preview-3314--moor.netlify.app |
Why do they have to be extensions? So that mockito doesn't try to mock them? |
What does the Managers class use? Managers {
// Private: Bad for Mockito
final _Database db;
} A private Hmm, lets make it work with the public one: Managers {
// Public!
final Database db;
} Ok, but wait: class _Database extends GeneratedDatabase {
Managers get managers => Managers(this); // BAD! `this` is not a `Database` its a `_Database `
} So the only way extension DatabaseManagersExt on Database {
Managers get managers => Managers(this);
} What do you think? |
There is a bug in mockito which is not allowing us to mock individual managers, I'm going to make a repro and open an issue on their repo, it's a mockito issue, not a drift one |
Is there a way to test that we're not breaking mockito as part of the CI? We're already running that builder on |
I've added the database manager (db.managers) to the mockito so we know that now works, before it didn't. This PR includes a mock that tests itself |
Opened a PR on mockito, if you know someone at google that can expedite this review I would appreciate it. But this PR is good to go. Let mockito figure themselves out. |
My PR for mockito is complete. Hopefully they cherry-pick it into a release. |
Argh! |
Modular generation fixes this entire mess! Maybe we should add this to the docs. It makes a public base class |
Instead of managers being fields on private classes:
We now have them on extension on the public class:
This will allow mockito to do whatever it wants as Manager doesn't rely on a private class
closes #3015