public function testSetParameter()
 {
     $this->assertFalse($this->_sut->hasParameter('foo'));
     $this->_sut->setParameter('foo', 'bar');
     $this->assertTrue($this->_sut->hasParameter('foo'));
     $this->assertEquals('bar', $this->_sut->getParameter('foo'));
 }
 public function testLoad()
 {
     $this->prepareForLoad();
     $this->_sut->load($this->_mockContainer);
     $realContainerBuilder = new tubepress_internal_ioc_ContainerBuilder();
     $realContainerBuilder->registerExtension($this->_sut);
     foreach ($this->getExpectedExternalServicesMap() as $id => $type) {
         if (is_string($type)) {
             $realContainerBuilder->set($id, $this->mock($type));
         } else {
             $realContainerBuilder->set($id, $type);
         }
     }
     foreach ($this->getExpectedParameterMap() as $key => $value) {
         $realContainerBuilder->setParameter($key, $value);
     }
     foreach ($this->_expectedDecoratedServices as $serviceId) {
         $decoratedDefinition = new tubepress_internal_ioc_Definition($serviceId);
         $decoratedDefinition->setFactoryClass('Mockery');
         $decoratedDefinition->setFactoryMethod('mock');
         $decoratedDefinition->addArgument($serviceId);
         $realContainerBuilder->setDefinition(strtolower($serviceId), $decoratedDefinition);
     }
     $this->preCompile($realContainerBuilder);
     $realContainerBuilder->compile();
     $this->postCompile($realContainerBuilder);
     foreach ($this->_expectedServiceConstructions as $id => $type) {
         $this->assertTrue($realContainerBuilder->hasDefinition($id), "Expected that container has definition for {$id}");
         $this->assertTrue($realContainerBuilder->has($id), "Expected that container has definition for {$id}");
         $service = $realContainerBuilder->get($id);
         if (is_string($type)) {
             $this->assertInstanceOf($type, $service, "{$id} is not an instance of {$type} (actually is " . get_class($service) . ')');
         } else {
             /**
              * @var $def tubepress_api_ioc_DefinitionInterface
              */
             $def = $type;
             $this->assertInstanceOf($def->getClass(), $service);
         }
     }
 }
 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;
 }