laracasts / TestDummy

Easy factories for PHP integration testing.
https://laracasts.com/lessons/whats-new-in-testdummy
MIT License
455 stars 80 forks source link

added check for string type when checking for relationships on persist #73

Closed bbrothers closed 9 years ago

bbrothers commented 9 years ago

Same as #55 but with an updated test.

$factory('Album', [
    'name'       => $faker->name,
    'created_at' => $faker->datetime
];

Throws the error:

warning: preg_match() expects parameter 2 to be string, array given in 
    /path/TestDummy/src/Laracasts/TestDummy/Builder.php line 211

This patch adds a quick type check before running preg_match to check for a relationship.

swekaj commented 9 years ago

This duplicates #55, though I see you modified the tests which I didn't.

bbrothers commented 9 years ago

Yeah, I noticed that after and mentioned it in the comment above. I wouldn't have added the PR except that #55 is a few months old and I hoped that the updated test might help get it merged in a bit quicker.

JeffreyWay commented 9 years ago

Thanks both of you. Merged @swekaj, since was first (and overdue).