コード例 #1
0
ファイル: Dispatcher.php プロジェクト: spewia/spewia
 /**
  * Configures all the systems SetUp by the Dispatcher with the files in the $configuration_dir directory.
  *
  * @param string $configuration_dir
  *
  * @throws \Spewia\Dispatcher\Exception\FileNotFoundException If a required file isn't found.
  *
  * @return DispatcherInterface Reference to the Dispatcher object itself.
  */
 public function configure($configuration_dir)
 {
     $dic_configuration_file = $configuration_dir . '/dic_configuration.php';
     if (!file_exists($dic_configuration_file)) {
         throw new FileNotFoundException('The dependency injection configuration file couldn\'t be found in "' . $dic_configuration_file . '".');
     }
     $this->container->addServiceConfigurations(include $dic_configuration_file);
     $project_configuration_file = $configuration_dir . '/project_configuration.php';
     if (file_exists($project_configuration_file)) {
         $this->project_configuration = (include $project_configuration_file + $this->project_configuration);
     }
     return $this;
 }
コード例 #2
0
ファイル: ContainerTest.php プロジェクト: spewia/spewia
 public function testAddServiceConfigurationsOverwrites()
 {
     $this->object->get('foo2');
     $this->object->addServiceConfigurations(array('foo2' => array('class' => self::BAR_CLASS, 'constructor_parameters' => array(array('type' => 'service', 'id' => 'foo'), array('type' => 'constant', 'value' => 'string')))));
     $bar = $this->object->get('foo2');
     $this->assertInstanceOf(self::BAR_CLASS, $bar, 'The element whose configuration has changed should be of class "Bar". If there was an instance of the ' . 'previous configuration, it shouldn\'t have been used.');
 }