public function testProcessUpdateEntities()
 {
     $em = $this->getMockBuilder('Doctrine\\ORM\\EntityManager')->disableOriginalConstructor()->getMock();
     $testEntity = new \stdClass();
     $resultActivityList = new ActivityList();
     $this->chainProvider->expects($this->once())->method('getUpdatedActivityList')->with($testEntity)->willReturn($resultActivityList);
     $em->expects($this->once())->method('persist')->with($resultActivityList);
     $uow = $this->getMockBuilder('Doctrine\\ORM\\UnitOfWork')->disableOriginalConstructor()->getMock();
     $em->expects($this->once())->method('getUnitOfWork')->willReturn($uow);
     $metaData = $this->getMockBuilder('Doctrine\\ORM\\Mapping\\ClassMetadata')->disableOriginalConstructor()->getMock();
     $em->expects($this->once())->method('getClassMetadata')->with('Oro\\Bundle\\ActivityListBundle\\Entity\\ActivityList')->willReturn($metaData);
     $uow->expects($this->once())->method('computeChangeSet')->with($metaData, $resultActivityList);
     $this->assertTrue($this->manager->processUpdatedEntities([$testEntity], $em));
 }
示例#2
0
 /**
  * Collect inserted owners activity entities
  *
  * @param array $entities
  */
 protected function collectInsertedOwnerEntities(array $entities)
 {
     foreach ($entities as $hash => $entity) {
         if ($this->activityListManager->isSupportedOwnerEntity($entity) && empty($this->insertedOwnerEntities[$hash])) {
             $this->insertedOwnerEntities[$hash] = $entity;
         }
     }
 }
 public function testIsSupportedOwnerEntity()
 {
     $testEntity = new \stdClass();
     $this->chainProvider->expects($this->once())->method('isSupportedOwnerEntity')->with($testEntity)->willReturn(true);
     $this->assertTrue($this->manager->isSupportedOwnerEntity($testEntity));
 }