コード例 #1
0
 public function testGetClass()
 {
     $config1 = $this->getMock('Oro\\Bundle\\EntityConfigBundle\\Config\\ConfigInterface');
     $config2 = $this->getMock('Oro\\Bundle\\EntityConfigBundle\\Config\\ConfigInterface');
     $configs = ['scope1' => $config1, 'scope2' => $config2];
     $configManager = $this->getMockBuilder('Oro\\Bundle\\EntityConfigBundle\\Config\\ConfigManager')->disableOriginalConstructor()->getMock();
     $className = 'Test\\Entity';
     $event = new PreFlushConfigEvent($configs, $configManager);
     $config1->expects($this->once())->method('getId')->willReturn(new EntityConfigId('scope1', $className));
     $config2->expects($this->never())->method('getId');
     $this->assertEquals($className, $event->getClassName());
     // test that a local cache is used
     $this->assertEquals($className, $event->getClassName());
 }
コード例 #2
0
 /**
  * @param PreFlushConfigEvent $event
  */
 public function preFlush(PreFlushConfigEvent $event)
 {
     if ($event->isFieldConfig()) {
         return;
     }
     $className = $event->getClassName();
     $configProvider = $event->getConfigManager()->getProvider('security');
     if ($configProvider->hasConfig($className)) {
         $this->provider->clearCache($configProvider->getConfig($className)->get('type'));
     }
 }