/**
  * @dataProvider provideTestNodeMovedEvents
  */
 public function testHandleEventsNodeMovedEvent(array $event_state, array $subject, array $parent, array $query, array $projections, array $expectations)
 {
     $mock_finder_result = Mockery::mock(FinderResultInterface::CLASS);
     foreach ($projections as $projection) {
         $related_projections[] = $this->createProjection($projection);
     }
     // query execution expectations for moved nodes
     $mock_query_service_map = Mockery::mock(QueryServiceMap::CLASS);
     $mock_query_service = Mockery::mock(QueryServiceInterface::CLASS);
     $mock_query_service_map->shouldReceive('getItem')->once()->with('honeybee_tests.game_schema.team::projection.standard::query_service')->andReturn($mock_query_service);
     $mock_query_service->shouldReceive('scroll')->once()->with(Mockery::on(function (QueryInterface $search_query) use($query) {
         $this->assertEquals($query, $search_query->toArray());
         return true;
     }), Mockery::on(function (\Closure $callback) use($related_projections) {
         foreach ($related_projections as $index => $projection) {
             $callback($projection, $index);
         }
         return true;
     }))->andReturnNull();
     $mock_finder = Mockery::mock(FinderInterface::CLASS);
     $this->addEmdeddedEventsToMockFinder($mock_finder, $event_state['embedded_entity_events'], $mock_finder_result);
     $mock_storage_writer = Mockery::mock(ProjectionWriter::CLASS);
     $this->addExpectationsToStorageWriter($mock_storage_writer, $expectations);
     $mock_event_bus = Mockery::mock(EventBusInterface::CLASS);
     $this->addExpectationsToEventBus($mock_event_bus, $expectations);
     $mock_data_access_service = Mockery::mock(DataAccessServiceInterface::CLASS);
     $mock_data_access_service->shouldReceive('getStorageWriter')->once()->andReturn($mock_storage_writer);
     // expectations for loading subject
     $subject = $this->createProjection($subject);
     $mock_storage_reader = Mockery::mock(ProjectionReader::CLASS);
     $mock_storage_reader->shouldReceive('read')->once()->with($subject->getIdentifier())->andReturn($subject);
     $mock_data_access_service->shouldReceive('getStorageReader')->once()->with($subject->getType()->getVariantPrefix() . '::view_store::reader')->andReturn($mock_storage_reader);
     // expectation for loading parent when necessary
     if (!empty($parent)) {
         $parent = $this->createProjection($parent);
         $mock_storage_reader->shouldReceive('read')->once()->with($parent->getIdentifier())->andReturn($parent);
         $mock_data_access_service->shouldReceive('getStorageReader')->once()->with($parent->getType()->getVariantPrefix() . '::view_store::reader')->andReturn($mock_storage_reader);
     }
     // prepare and execute tests
     $projection_updater = new ProjectionUpdater(new ArrayConfig([]), new NullLogger(), $mock_data_access_service, $mock_query_service_map, $this->projection_type_map, $this->aggregate_root_type_map, $mock_event_bus);
     $event = $this->buildEvent($event_state);
     $projection = $projection_updater->handleEvent($event);
     $this->assertInstanceOf(ProjectionInterface::CLASS, $projection);
 }
 public function __construct(ConfigInterface $config, LoggerInterface $logger, DataAccessServiceInterface $data_access_service, QueryServiceMap $query_service_map, ProjectionTypeMap $projection_type_map, AggregateRootTypeMap $aggregate_root_type_map, EventBusInterface $event_bus, MailService $mail_service)
 {
     parent::__construct($config, $logger, $data_access_service, $query_service_map, $projection_type_map, $aggregate_root_type_map, $event_bus);
     $this->mail_service = $mail_service;
 }