JeffreyWay / Laravel-Test-Helpers

Easier testing in Laravel.
https://packagist.org/packages/way/laravel-test-helpers
217 stars 40 forks source link

Fix to Issue #46 - Factory.php attempting to create relationship for fields with {$class}_id #59

Open GrandadEvans opened 10 years ago

GrandadEvans commented 10 years ago

Factory.php was not taking into account fields that have {$class}_id as their primary key instead of id eg user_id as the primary key for the users table. - fixed and tests still pass.

All existing test passing but sorry - I'm only half way into "Laravel Testing Decoded" so not confident enough to write additional test as I get to the if (static::$isSaving and pregmatch('/([A-z]+)[-]id$/i', $field, $matches)) line (c. 330) and I'm not sure you want to set the $isSaving to true & start saving to a db.