コード例 #1
0
 /**
  * Process any imports
  *
  * @param array $configuration
  * @param $source
  */
 protected function processImports(array &$configuration, $source)
 {
     foreach ($configuration as $key => $value) {
         if ($key == 'imports') {
             foreach ($value as $resource) {
                 $basePath = str_replace(basename($source), '', $source);
                 $parser = new Yaml();
                 $this->configuration = array_merge($parser->parse($basePath . $resource['resource']), $configuration);
             }
             unset($configuration['imports']);
         }
     }
 }
コード例 #2
0
 /**
  * Test that a yaml configuration file with imports is parsed correctly
  */
 public function testParsesImportFileCorrectly()
 {
     $this->assertEquals(['swiftmailer' => ['host' => 'smtp.example.com', 'port' => 999, 'username' => 'test', 'password' => 'user', 'encryption' => false, 'auth_mode' => ''], 'application' => ['name' => 'Test Application', 'defaults' => ['page_title' => 'Welcome to Test Application', 'page_description' => 'Welcome to Test Application'], 'domain' => 'example.com']], $this->parser->parse(__DIR__ . '/../resource/test_config_b.yml'));
 }