thephpleague / factory-muffin

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

My fields are being replaced #433

Open heremiguel opened 7 years ago

heremiguel commented 7 years ago

Hi all, I have got a problem when I create a record using:

use League\FactoryMuffin\Faker\Facade as Faker;

$fm = new FactoryMuffin();
$fm->loadFactories(__DIR__ . '/factories');

$fm->define('Partner')->setDefinitions([
    'Partner'=> 'Partner Name',
    'CreatedAt'=> '2015-10-25 00:00:00',
    'UpdatedAt'=> '2015-10-25 00:00:00',
    'Status'=> 1,
    'Email'=> Faker::email()
]);

$fm->create('Partner', []);

For any reason my columns CreatedAt and UpdatedAt are being replaced with created_at and updated_at. I don't have any code to do that

I got this error: column not found: 1054 Unknown column 'created_at' in 'field list' (SQL: insert into Partner (Partner, **created_at**, **updated_at**, Status, Email) values (Partner Name, , abc, 2015-10-25 00:00:00, 2015-10-25 00:00:00, 1, email@test.com)

I got in my model

public $timestamps = false;

My application is working properly without any problem, that error is shown when I run phpunit and try to test the partner insert.

Anyone can help me please?