/**
  * @dataProvider changeSetProvider
  *
  * @param $scope
  * @param $change
  * @param $shouldClearCache
  */
 public function testPersistConfig($scope, $change, $shouldClearCache)
 {
     $config = new Config(new EntityConfigId($scope, 'Test\\Entity'));
     $configManager = $this->getMockBuilder('Oro\\Bundle\\EntityConfigBundle\\Config\\ConfigManager')->disableOriginalConstructor()->getMock();
     $configManager->expects($this->exactly($scope === 'email' ? 1 : 0))->method('getConfigChangeSet')->with($this->identicalTo($config))->will($this->returnValue($change));
     $this->cache->expects($this->exactly($shouldClearCache ? 1 : 0))->method('delete')->with(self::TEST_CACHE_KEY);
     $this->subscriber->persistConfig(new PersistConfigEvent($config, $configManager));
 }
Exemplo n.º 2
0
 /**
  * @dataProvider changeSetProvider
  * @param $scope
  * @param $change
  * @param $shouldClearCache
  */
 public function testPersistConfig($scope, $change, $shouldClearCache)
 {
     $cmMock = $this->getMockBuilder('Oro\\Bundle\\EntityConfigBundle\\Config\\ConfigManager')->disableOriginalConstructor()->getMock();
     $cmMock->expects($this->once())->method('calculateConfigChangeSet');
     $cmMock->expects($this->once())->method('getConfigChangeSet')->will($this->returnValue($change));
     $configId = $this->getMockBuilder('Oro\\Bundle\\EntityConfigBundle\\Config\\Id\\ConfigIdInterface')->disableOriginalConstructor()->getMock();
     $configId->expects($this->once())->method('getScope')->will($this->returnValue($scope));
     $config = $this->getMockBuilder('Oro\\Bundle\\EntityConfigBundle\\Config\\ConfigInterface')->disableOriginalConstructor()->getMock();
     $config->expects($this->once())->method('getId')->will($this->returnValue($configId));
     $event = new PersistConfigEvent($config, $cmMock);
     $this->cache->expects($this->exactly((int) $shouldClearCache))->method('delete');
     $this->subscriber->persistConfig($event);
 }