/** * @depends testCreate */ public function testSetValue(ConfigModel $config) { $event = new ConfigUpdateEvent($config->getId()); $event->setValue('baz')->setDispatcher($this->dispatcher); $action = new Config(); $action->setValue($event); $updatedConfig = $event->getConfig(); $this->assertInstanceOf('Thelia\\Model\\Config', $updatedConfig); $this->assertEquals($config->getName(), $updatedConfig->getName()); $this->assertEquals('baz', $updatedConfig->getValue()); $this->assertEquals($config->getLocale(), $updatedConfig->getLocale()); $this->assertEquals($config->getTitle(), $updatedConfig->getTitle()); $this->assertEquals($config->getHidden(), $updatedConfig->getHidden()); $this->assertEquals($config->getSecured(), $updatedConfig->getSecured()); return $updatedConfig; }
/** * Change values modified directly from the variable list * * @return Thelia\Core\HttpFoundation\Response the response */ public function changeValuesAction() { // Check current user authorization if (null !== ($response = $this->checkAuth($this->resourceCode, array(), AccessManager::UPDATE))) { return $response; } $variables = $this->getRequest()->get('variable', array()); // Process all changed variables foreach ($variables as $id => $value) { $event = new ConfigUpdateEvent($id); $event->setValue($value); $this->dispatch(TheliaEvents::CONFIG_SETVALUE, $event); } return $this->generateRedirectFromRoute('admin.configuration.variables.default'); }