/** * @dataProvider dataTest */ public function testLoad($schema) { $container = $this->getMock('Symfony\\Component\\DependencyInjection\\ContainerBuilder', array()); $container->expects($this->exactly(count($schema)))->method('setParameter')->with($this->logicalOr($this->identicalTo('my_site.email.sender_name'), $this->identicalTo('my_site.email.sender_email')), $this->logicalOr($this->identicalTo('Me'), $this->identicalTo('*****@*****.**'))); $injecter = new ContainerInjectionManager($this->getEmptyDalMocked(), $schema, ''); $injecter->inject($container); }
public function __get($name) { if (strpos($name, 'setting_') === 0) { $name = str_replace('setting_', '', $name); if (!array_key_exists($name, $this->schema)) { trigger_error(sprintf('Property %s does not exist in dynamic settings.', $name)); } return $this->parametersStorage->get($this->schema[$name]['key']); } elseif (strpos($name, 'default_setting_') === 0) { $name = str_replace('default_setting_', '', $name); if (!array_key_exists($name, $this->schema)) { trigger_error(sprintf('Property %s does not exist in dynamic settings.', $name)); } return $this->schema[$name]['default']; } elseif (strpos($name, 'form_') === 0) { $name = str_replace('form_', '', $name); return $this->formName($name); } elseif (strpos($name, 'real_') === 0) { $value = $this->schema[$this->keyDict[$name]]['default']; if ($this->parametersStorage->has($name)) { $value = $this->parametersStorage->get($name); } return $value; } elseif (array_key_exists($name, $this->keyDict)) { $parameterName = $this->containerInjectionManager->getParametersName($name); if (!$this->container->hasParameter($parameterName)) { throw new \InvalidArgumentException(); } $value = $this->container->getParameter($parameterName); return $value; } trigger_error(sprintf('Property %s does not exist in dynamic settings.', $name)); }