/** * {@inheritdoc} */ public function build($config, array $options = null) { if (!$this->loader) { $this->loader = new JsonLoader(); } return ServiceDescription::factory($this->loader->parseJsonFile($config)); }
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']); }
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']); }