laravel-mongodb
laravel-mongodb copied to clipboard
Cannot fill model _id property in unit test
Hello,
In unit test I want to mock collection of models which are requested from Mongo DB
Problem is that I need to fill _id
property as well and it fails with message
Error: Call to a member function connection() on null
Here is how I do it
$modelFactory = new MyModelFactory();
$model = $modelFactory->make(['_id'=>'bestproduct2022']);
In my case _id
is not autogenerated, it is filled manually.
Is there any workarounds possible in order to fill this property ?
Thank you