/**
  * @return void
  */
 public function testBulkDeleteBuildsAndExecutesQueries()
 {
     $touchUpdaterSet = $this->createTouchUpdaterSet();
     $idLocale = 1;
     $connection = $this->createConnectionMock();
     $touchUpdater = $this->createTouchUpdater();
     $expectedQuery = 'DELETE FROM touchKeyTableName_value WHERE fk_touch IN (id_touch1,id_touch2)';
     $connection->expects($this->once())->method('exec')->with($expectedQuery);
     $this->assertEmpty($this->bulkTouchDeleteQuery->getRawSqlString());
     $touchUpdater->bulkDelete($touchUpdaterSet, $idLocale, $connection);
 }
 /**
  * @param \Spryker\Zed\Collector\Business\Exporter\Writer\Storage\TouchUpdaterSet $touchUpdaterSet
  * @param int $idLocale
  * @param \Propel\Runtime\Connection\ConnectionInterface|null $connection
  *
  * @return void
  */
 public function bulkDelete(TouchUpdaterSet $touchUpdaterSet, $idLocale, ConnectionInterface $connection = null)
 {
     $idsToDelete = [];
     foreach ($touchUpdaterSet->getData() as $key => $touchData) {
         $idTouch = $touchData[CollectorConfig::COLLECTOR_TOUCH_ID];
         if ($idTouch !== null) {
             $idsToDelete[$idTouch] = $idTouch;
         }
     }
     if (!empty($idsToDelete) && $connection !== null) {
         $sql = $this->bulkTouchDeleteQuery->addQuery($this->touchKeyTableName, static::FK_TOUCH, $idsToDelete)->getRawSqlString();
         $this->bulkTouchDeleteQuery->flushQueries();
         $connection->exec($sql);
     }
 }