bulkSave() public method

Bulk save a collection Models.
public bulkSave ( array | Collection $collection = [] ) : mixed
$collection array | Illuminate\Support\Collection
return mixed
 /**
  * @test
  */
 public function it_saves_models_data_in_bulk()
 {
     $connection = \Mockery::mock(Connection::class);
     $connection->shouldReceive('getDefaultIndex')->once()->andReturn('plastic');
     $model1 = new PersistenceModelTest();
     $model2 = new PersistenceModelTest();
     $collection = [$model1, $model2];
     $connection->shouldReceive('bulkStatement')->once()->with(['body' => [['index' => ['_id' => null, '_type' => 'foo', '_index' => 'bar']], ['foo' => 'bar'], ['index' => ['_id' => null, '_type' => 'foo', '_index' => 'bar']], ['foo' => 'bar']]]);
     $persistence = new EloquentPersistence($connection);
     $persistence->bulkSave($collection);
 }