thephpleague / factory-muffin

Enables the rapid creation of objects for testing
https://factory-muffin.thephpleague.com/
MIT License
532 stars 72 forks source link

Factory Muffin converts false values to empty strings #456

Open kirkbushell opened 5 years ago

kirkbushell commented 5 years ago

This results in database errors when strict mode is enabled (for example, '' is an invalid value for a boolean field).

This happens when getGenerator in Base.php is working with a $kind of false. It explodes on |, resulting in an empty string, converting a false value. This does not happen with true boolean values.

My solution, if you're happy to have this resolved (we can't actually use strict mode in our integrated tests without it, as it fails each time), is to have getGenerator return $this->kind if $this->kind === false.

GrahamCampbell commented 5 years ago

My solution, if you're happy to have this resolved

Sounds good. 👍