コード例 #1
0
 public function setUp()
 {
     parent::setUp();
     $meta = $this->em->getClassMetadata('Oro\\Bundle\\UserBundle\\Entity\\User');
     $meta->setCustomRepositoryClass('Oro\\Bundle\\DataAuditBundle\\Tests\\Unit\\Fixture\\Repository\\UserRepository');
     $this->config = $this->loggableAnnotationDriver->extendLoadMetadataForClass($this->em->getClassMetadata('Oro\\Bundle\\DataAuditBundle\\Tests\\Unit\\Fixture\\LoggableClass'));
     $provider = $this->getMockBuilder('\\Oro\\Bundle\\EntityConfigBundle\\Provider\\ConfigProvider')->disableOriginalConstructor()->getMock();
     $provider->expects($this->any())->method('isConfigurable')->will($this->returnValue(false));
     $this->loggableManager = new LoggableManager('Oro\\Bundle\\DataAuditBundle\\Entity\\Audit', $provider);
     $this->loggableManager->addConfig($this->config);
     $this->loggableClass = new LoggableClass();
     $this->loggableClass->setName('testName');
 }
コード例 #2
0
 protected function setUp()
 {
     parent::setUp();
     $meta = $this->em->getClassMetadata('Oro\\Bundle\\UserBundle\\Entity\\User');
     $meta->setCustomRepositoryClass('Oro\\Bundle\\DataAuditBundle\\Tests\\Unit\\Fixture\\Repository\\UserRepository');
     $this->config = $this->loggableAnnotationDriver->extendLoadMetadataForClass($this->em->getClassMetadata('Oro\\Bundle\\DataAuditBundle\\Tests\\Unit\\Fixture\\LoggableClass'));
     $provider = $this->getMockBuilder('\\Oro\\Bundle\\EntityConfigBundle\\Provider\\ConfigProvider')->disableOriginalConstructor()->getMock();
     $provider->expects($this->any())->method('isConfigurable')->will($this->returnValue(false));
     $this->securityContext = $this->getMock('Symfony\\Component\\Security\\Core\\SecurityContextInterface');
     $securityContextLink = $this->getMockBuilder('Oro\\Bundle\\EntityConfigBundle\\DependencyInjection\\Utils\\ServiceLink')->disableOriginalConstructor()->getMock();
     $securityContextLink->expects($this->any())->method('getService')->will($this->returnValue($this->securityContext));
     $this->loggableManager = new LoggableManager('Oro\\Bundle\\DataAuditBundle\\Entity\\Audit', 'Oro\\Bundle\\DataAuditBundle\\Entity\\AuditField', $provider, $securityContextLink);
     $this->loggableManager->addConfig($this->config);
     $this->loggableClass = new LoggableClass();
     $this->loggableClass->setName('testName');
 }
コード例 #3
0
 /**
  * @test
  */
 public function testHandlePostPersist()
 {
     $loggableClass = new LoggableClass();
     $loggableClass->setName('testName');
     $this->loggableManager->handlePostPersist($loggableClass, $this->em);
 }