Exemple #1
0
 public function testConfigDiff()
 {
     $this->assertEmpty($this->configLogDiff->getId());
     $this->configLogDiff->setLog($this->configLog);
     $this->assertEquals($this->configLog, $this->configLogDiff->getLog());
     $this->configLogDiff->setClassName('className');
     $this->assertEquals('className', $this->configLogDiff->getClassName());
     $this->configLogDiff->setFieldName('fieldName');
     $this->assertEquals('fieldName', $this->configLogDiff->getFieldName());
     $this->configLogDiff->setScope('scope');
     $this->assertEquals('scope', $this->configLogDiff->getScope());
     $this->configLogDiff->setDiff(array('key' => 'value'));
     $this->assertEquals(array('key' => 'value'), $this->configLogDiff->getDiff());
 }
Exemple #2
0
 /**
  * @param ConfigInterface $config
  * @param ConfigManager   $configManager
  *
  * @return ConfigLogDiff
  */
 protected function computeChanges(ConfigInterface $config, ConfigManager $configManager)
 {
     $configId = $config->getId();
     $internalValues = $configManager->getProvider($configId->getScope())->getPropertyConfig()->getNotAuditableValues($configId);
     $changes = array_diff_key($configManager->getConfigChangeSet($config), $internalValues);
     if (empty($changes)) {
         return null;
     }
     $diff = new ConfigLogDiff();
     $diff->setScope($configId->getScope());
     $diff->setDiff($changes);
     $diff->setClassName($configId->getClassName());
     if ($configId instanceof FieldConfigId) {
         $diff->setFieldName($configId->getFieldName());
     }
     return $diff;
 }