/**
  * @dataProvider getSerializeData
  */
 public function testSerialize($encoding, $nonSerialized, $serialized)
 {
     $this->_mockBootSettings->shouldReceive('getSerializationEncoding')->twice()->andReturn($encoding);
     $actualSerialized = $this->_sut->serialize($nonSerialized);
     $this->assertEquals($serialized, $actualSerialized);
     $actualDeserialized = $this->_sut->unserialize($serialized);
     $this->assertEquals($nonSerialized, $actualDeserialized);
 }
 public function __construct(array $bootArtifacts, $key, tubepress_api_log_LoggerInterface $logger, tubepress_internal_boot_helper_uncached_Serializer $serializer)
 {
     $this->_logger = $logger;
     $this->_nameToInstanceMap = array();
     if (!isset($bootArtifacts[$key])) {
         throw new InvalidArgumentException("{$key} not found in boot artifacts");
     }
     $contributables = $serializer->unserialize($bootArtifacts[$key]);
     if (!is_array($contributables)) {
         throw new InvalidArgumentException('Expected to deserialize an array');
     }
     foreach ($contributables as $contributable) {
         if (!$contributable instanceof tubepress_api_contrib_ContributableInterface) {
             throw new InvalidArgumentException('Unserialized data contained a non contributable');
         }
         $name = $contributable->getName();
         $this->_nameToInstanceMap[$name] = $contributable;
     }
 }
 /**
  * @param tubepress_api_ioc_ContainerBuilderInterface $containerBuilder The primary service container builder.
  *
  * @api
  *
  * @since 4.0.0
  */
 public function process(tubepress_api_ioc_ContainerBuilderInterface $containerBuilder)
 {
     if (!$containerBuilder->hasParameter(tubepress_internal_boot_PrimaryBootstrapper::CONTAINER_PARAM_BOOT_ARTIFACTS)) {
         return;
     }
     $bootArtifacts = $containerBuilder->getParameter(tubepress_internal_boot_PrimaryBootstrapper::CONTAINER_PARAM_BOOT_ARTIFACTS);
     if (!is_array($bootArtifacts) || !isset($bootArtifacts['themes'])) {
         return;
     }
     $serializedThemes = $bootArtifacts['themes'];
     $bootSettings = $containerBuilder->get(tubepress_api_boot_BootSettingsInterface::_);
     $serializer = new tubepress_internal_boot_helper_uncached_Serializer($bootSettings);
     $unserializedThemes = $serializer->unserialize($serializedThemes);
     $adjustedSystemThemes = $this->_adjustLegacySystemThemes($containerBuilder, $unserializedThemes);
     $userLegacyThemes = $this->_findUserLegacyThemes($bootSettings, $containerBuilder);
     $allLegacyThemes = array_merge($adjustedSystemThemes, $userLegacyThemes);
     $allThemes = array_merge($unserializedThemes, $allLegacyThemes);
     $serializedThemes = $serializer->serialize($allThemes);
     $bootArtifacts['themes'] = $serializedThemes;
     $containerBuilder->setParameter(tubepress_internal_boot_PrimaryBootstrapper::CONTAINER_PARAM_BOOT_ARTIFACTS, $bootArtifacts);
 }