lukeraymonddowning / poser

Create class based model factories in Laravel applications in seconds.
MIT License
276 stars 10 forks source link

Pass a collection by default #85

Closed dsazup closed 4 years ago

dsazup commented 4 years ago

Hey, this fixes #84. Although I am not sure if this is a good change, so if you do not think this is a bug, feel free to close it.

lukeraymonddowning commented 4 years ago

Hi Friend!

Thanks for your contribution. I'm working today so will try to have a look this evening!

lukeraymonddowning commented 4 years ago

Just had a super quick look. I've not tried it, but I imagine this will now always return a collection?

dsazup commented 4 years ago

Hey, thanks for looking into it and take your time. 👍

Just had a super quick look. I've not tried it, but I imagine this will now always return a collection?

Afaik it does not change what is returned. It changes what is passed to callAfterCreating which does not return anything. Down below it still has:

$this->createdInstance = $returnFirstCollectionResultAtEnd ? $result->first() : $result;

$this->testCaseCaller->processAssertions($this->createdInstance);

return $this->createdInstance;
lukeraymonddowning commented 4 years ago

Okay, just got around to testing this, and everything seems fine and dandy. Merging in 👌

lukeraymonddowning commented 4 years ago

@all-contributors please add @dsazup for code

allcontributors[bot] commented 4 years ago

@lukeraymonddowning

I've put up a pull request to add @dsazup! :tada: