Comments (9)
In fact the role of the factory is to transform config, and pass it to a new valid Google/Redis/xxx object. So, in the tests, we should check that the object is really valid, and it received the proper configuration. By mocking the creation as actual, we don't test if the client was created properly.
I think this is the reason why the make -with-arguments method was considerated as a code smell.
from laravel-pubsub.
Thanks for reporting this.
We'll take a look and see if there's a neater way of constructing these objects without passing in custom configuration.
from laravel-pubsub.
Guys ? Some news ?
from laravel-pubsub.
HI @mathieutu. I am actually struggling a lot with this at the moment. You can see I asked the question on the internals channel.
I made a branch so long to try out a couple of things. I wanted to keep the nice aliases but also extract the configs for each dependency out. In the process of designing like a configuration provider type class that knows how to transform the dependencies for those three affected clients, redis
, google pubsub
and kafka
but its proving hard because essentially we are ending up with a FactoryFacotry
and that it the real code smell imho.
You can see in the comparison, the road that I want to take but I am hitting a wall where the config that the client needs to be initialised with is now not really testable.
What are your thoughts?
from laravel-pubsub.
Hi @etiennemarais!
I understand your problem. In fact as I said I think we should test the real object, created by the factory, and don't mock it. You pass a conf, and check at the end if it's a proper instance, an if it have the proper conf.
But, even if I think this could be better, @taylorotwell made a PR with a makeWith
method which we will be alble to use soon, so problem will be solved anyway...
from laravel-pubsub.
Ye I saw that post he made on the internals main issue. I will make a PR this weekend to take a run at the config closure passing which is actually not too bad imo. We can review it together and make a call.
from laravel-pubsub.
Good news, Taylor implemented a makeWith
method to bring back the old functionality. See Pull request. I will spend some time today to swap this out, or if you want make a PR @mathieutu then I will merge it in. It seems like this issue affected so many people that it worked in getting it back.
from laravel-pubsub.
Yep ! It's what I told you here : #6 (comment)
Ok, I'm a bit busy right now, but the first one with time make the PR make it, and warn the other on!
:)
from laravel-pubsub.
Thanks for the PR.
This is published in 2.0.3
from laravel-pubsub.
Related Issues (6)
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from laravel-pubsub.