Synchronizer does work that is kind of opposite to the ones of storages but with one major difference: while storages usually add or delete entities one by one or by small amounts, synchronizer usually operates over all entities or some subset (see $entitiesToSynchronize). Synchronizers are run by the {@link VersionPress\Synchronizers\SynchronizationProcess}.
 /**
  * @test
  * @testdox Synchronizer removes deleted termmeta from the database (selective synchronization)
  */
 public function synchronizerRemovesDeletedTermMetaFromDatabase_selective()
 {
     $entitiesToSynchronize = $this->deleteTermMeta();
     $this->synchronizer->synchronize(Synchronizer::SYNCHRONIZE_EVERYTHING, $entitiesToSynchronize);
     $this->termsSynchronizer->synchronize(Synchronizer::SYNCHRONIZE_EVERYTHING, $entitiesToSynchronize);
     DBAsserter::assertFilesEqualDatabase();
 }
 /**
  * @test
  * @testdox Synchronizer replaces value references
  */
 public function synchronizerReplacesValueReferences()
 {
     $post = EntityUtils::preparePost();
     $optionToSynchronize = [['vp_id' => 'site_icon', 'parent' => null]];
     $postToSynchronize = [['vp_id' => $post['vp_id'], 'parent' => null]];
     $previousSiteIcon = $this->storage->exists('site_icon') ? $this->storage->loadEntity('site_icon') : '';
     $this->postStorage->save($post);
     $option = EntityUtils::prepareOption('site_icon', $post['vp_id']);
     $this->storage->save($option);
     $this->postsSynchronizer->synchronize(Synchronizer::SYNCHRONIZE_EVERYTHING, $postToSynchronize);
     $this->synchronizer->synchronize(Synchronizer::SYNCHRONIZE_EVERYTHING, $optionToSynchronize);
     DBAsserter::assertFilesEqualDatabase();
     // cleanup
     if ($previousSiteIcon) {
         if (!isset($previousSiteIcon['option_value'])) {
             $previousSiteIcon['option_value'] = false;
         }
         $this->storage->save($previousSiteIcon);
     } else {
         $this->storage->delete($option);
     }
     $this->postStorage->delete($post);
     $this->synchronizer->reset();
     $this->postsSynchronizer->reset();
     $this->synchronizer->synchronize(Synchronizer::SYNCHRONIZE_EVERYTHING, $optionToSynchronize);
     $this->postsSynchronizer->synchronize(Synchronizer::SYNCHRONIZE_EVERYTHING, $postToSynchronize);
 }
 /**
  * @test
  * @testdox Synchronizer removes deleted comment from the database (selective synchronization)
  */
 public function synchronizerRemovesDeletedCommentFromDatabase_selective()
 {
     $entitiesToSynchronize = $this->deleteComment();
     $this->synchronizer->synchronize(Synchronizer::SYNCHRONIZE_EVERYTHING, $entitiesToSynchronize);
     $this->postsSynchronizer->synchronize(Synchronizer::SYNCHRONIZE_EVERYTHING, $entitiesToSynchronize);
     $this->usersSynchronizer->synchronize(Synchronizer::SYNCHRONIZE_EVERYTHING, $entitiesToSynchronize);
     DBAsserter::assertFilesEqualDatabase();
 }
 /**
  * @test
  * @testdox Synchronizer restores shortcodes
  */
 public function synchronizerRestoresShortcodes()
 {
     $this->createPostWithShortcode();
     $this->usersSynchronizer->synchronize(Synchronizer::SYNCHRONIZE_EVERYTHING);
     $synchronizationTasks = [Synchronizer::SYNCHRONIZE_EVERYTHING];
     while (count($synchronizationTasks)) {
         $task = array_shift($synchronizationTasks);
         $remainingTasks = $this->synchronizer->synchronize($task);
         $synchronizationTasks = array_merge($synchronizationTasks, $remainingTasks);
     }
     DBAsserter::assertFilesEqualDatabase();
     $this->deletePost();
     $this->synchronizer->reset();
     $this->usersSynchronizer->reset();
     $this->synchronizer->synchronize(Synchronizer::SYNCHRONIZE_EVERYTHING);
     $this->usersSynchronizer->synchronize(Synchronizer::SYNCHRONIZE_EVERYTHING);
     DBAsserter::assertFilesEqualDatabase();
 }