/**
  * @param $pathToManifest
  *
  * @return tubepress_api_contrib_AddonInterface
  */
 protected function getAddonFromManifest($pathToManifest)
 {
     $mockUrlFactory = $this->mock(tubepress_api_url_UrlFactoryInterface::_);
     $mockUrlFactory->shouldReceive('fromString')->andReturnUsing(function ($incoming) {
         $factory = new tubepress_url_impl_puzzle_UrlFactory($_SERVER);
         return $factory->fromString($incoming);
     });
     $logger = new tubepress_internal_logger_BootLogger(false);
     $urlFactory = new tubepress_url_impl_puzzle_UrlFactory();
     $bootSettings = new tubepress_internal_boot_BootSettings($logger, $urlFactory);
     $langUtils = new tubepress_util_impl_LangUtils();
     $stringUtils = new tubepress_util_impl_StringUtils();
     $finderFactory = new tubepress_internal_finder_FinderFactory();
     $manifestFinder = new tubepress_internal_boot_helper_uncached_contrib_ManifestFinder(dirname($pathToManifest), 'whatevs', 'manifest.json', $logger, $bootSettings, $finderFactory);
     $addonFactory = new tubepress_internal_boot_helper_uncached_contrib_AddonFactory($logger, $urlFactory, $langUtils, $stringUtils, $bootSettings);
     $addonManifests = $manifestFinder->find();
     $this->assertTrue(count($addonManifests) === 1, 'Expected 1 add-on but got ' . count($addonManifests));
     $addons = array();
     foreach ($addonManifests as $manifestPath => $contents) {
         $addons[] = $addonFactory->fromManifestData($manifestPath, $contents);
     }
     $this->assertTrue($addons[0] instanceof tubepress_api_contrib_AddonInterface);
     return $addons[0];
 }
 private function _findAllAddons()
 {
     $manifests = $this->_manifestFinder->find();
     $addons = array();
     foreach ($manifests as $path => $data) {
         try {
             $errors = $this->_addonFactory->fromManifestData($path, $data);
             if (is_array($errors)) {
                 //these will have been logged already
                 continue;
             }
             $addons[] = $errors;
         } catch (Exception $e) {
             continue;
         }
     }
     if (!isset($this->_serializer)) {
         $this->_serializer = array(new tubepress_internal_boot_helper_uncached_Serializer($this->_bootSettings), 'serialize');
     }
     $artifacts = array('add-ons' => call_user_func($this->_serializer, $addons, $this->_bootSettings));
     $this->_containerBuilder->setParameter(tubepress_internal_boot_PrimaryBootstrapper::CONTAINER_PARAM_BOOT_ARTIFACTS, $artifacts);
     return $addons;
 }