Hey everyone,
I am slowly working my way through learning TDD and doing okay, except that I am using Spark and having issues following the documentation with this kind of declaration in my tests:
$this->actingAs(factory('App\User')->create());
This works, it creates the user no problem, but the test I am writing fails (I think!) because there's a check in Spark that stops a user from doing anything else until they join a Team! There is certainly a redirect that interferes with where I want to go next - if that makes sense?
So, my question is, what is the best way to go about creating a factory to first generate a user, then a team and finally assign the created user to that team. Does anyone have any code they have already written to overcome this issue they are willing to share please?
I suspect this is something that is going to get used a lot, so I am hoping someone can point me in the right direction as I can kinda see how to do it, but I am also quite new at this and any input that would expedite my progress would be very gratefully received.
Thank you!
As an aside, I would love to see all the tests that were written as part of the development for Spark - I think that would be very educational for me :)