plastic\tests\Persistence\EloquentPersistenceTest::it_saves_models_data_in_bulk PHP Метод

it_saves_models_data_in_bulk() публичный Метод

    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);
    }