Laravel-Test-Helpers
Laravel-Test-Helpers copied to clipboard
Fix to Issue #46 - Factory.php attempting to create relationship for fields with {$class}_id
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 preg_match('/([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.