Example #1
0
 /**
  * {@inheritdoc}
  */
 public function build($config, array $options = null)
 {
     if (!$this->loader) {
         $this->loader = new JsonLoader();
     }
     return ServiceDescription::factory($this->loader->parseJsonFile($config));
 }
Example #2
0
 public function testFactoryUsesAliases()
 {
     $file = dirname(__DIR__) . '/TestData/services/json1.json';
     $loader = new JsonLoader();
     $loader->addAlias('foo', $file);
     $data = $loader->parseJsonFile('foo');
     $this->assertEquals('bar', $data['services']['foo']['params']['baz']);
 }
Example #3
0
 public function testFactoryCanCreateFromJson()
 {
     $file = dirname(__DIR__) . '/TestData/services/json1.json';
     $loader = new JsonLoader();
     $data = $loader->parseJsonFile($file);
     $this->assertArrayHasKey('includes', $data);
     $this->assertArrayHasKey('services', $data);
     $this->assertInternalType('array', $data['services']['foo']);
     $this->assertInternalType('array', $data['services']['abstract']);
     $this->assertInternalType('array', $data['services']['mock']);
     $this->assertEquals('bar', $data['services']['foo']['params']['baz']);
 }