If I uncomment $company = Factory::create('Company') or $user = Factory::create('User') an error is thrown on the $product = Factory::product() line because it tries to insert data in the categories table.. I do see that the last call with Factory is Factory::category() before calling Factory::product() but it should not do any queries and certainly not on the categories table.
The code above works because all Factory::create() calls are worked around. I can create my test and make it work but it's probably not expected behaviour.
What I encounter is that Factory::product() does an sql query for categories when I use a Factory::create() call.
If I uncomment
$company = Factory::create('Company')
or$user = Factory::create('User')
an error is thrown on the$product = Factory::product()
line because it tries to insert data in the categories table.. I do see that the last call with Factory isFactory::category()
before callingFactory::product()
but it should not do any queries and certainly not on the categories table.The code above works because all
Factory::create()
calls are worked around. I can create my test and make it work but it's probably not expected behaviour.