public function testNotTaggable()
 {
     $this->helper->expects($this->once())->method('isTaggable')->willReturn(false);
     $this->entityMetadata = $this->getMockBuilder('Oro\\Bundle\\EntityMergeBundle\\Metadata\\EntityMetadata')->setMethods(['getClassName', 'addFieldMetadata'])->disableOriginalConstructor()->getMock();
     $this->entityMetadata->expects($this->any())->method('getClassName')->will($this->returnValue(get_class($this->createNotTaggableEntity())));
     $this->entityMetadata->expects($this->never())->method('addFieldMetadata');
     $event = new EntityMetadataEvent($this->entityMetadata);
     $this->listener->onBuildMetadata($event);
 }
 public function testOnBuildMetadata()
 {
     $entity = Note::ENTITY_NAME;
     $alias = 'oro_bundle_notebundle_entity_note';
     $calls = 1;
     $config = $this->getMock('Oro\\Bundle\\EntityConfigBundle\\Config\\ConfigInterface');
     $this->configProvider->expects($this->any())->method('getConfig')->willReturn($config);
     $config->expects($this->exactly($calls))->method('get')->willReturn('label');
     $fieldMetadataOptions = ['display' => true, 'activity' => true, 'type' => $entity, 'field_name' => $alias, 'is_collection' => true, 'template' => 'OroActivityListBundle:Merge:value.html.twig', 'label' => 'Items', 'merge_modes' => [MergeModes::NOTES_UNITE, MergeModes::NOTES_REPLACE]];
     $fieldMetadata = new FieldMetadata($fieldMetadataOptions);
     $this->entityMetadata->expects($this->at(1))->method('addFieldMetadata')->with($this->equalTo($fieldMetadata));
     $this->activityListChainProvider->expects($this->exactly($calls))->method('isApplicableTarget')->willReturn(true);
     $event = new EntityMetadataEvent($this->entityMetadata);
     $this->listener->onBuildMetadata($event);
 }
 /**
  * @dataProvider getDataProvider
  */
 public function testOnBuildMetadata($keys, $calls)
 {
     $config = $this->getMock('Oro\\Bundle\\EntityConfigBundle\\Config\\ConfigInterface');
     $this->configProvider->expects($this->any())->method('getConfig')->willReturn($config);
     $config->expects($this->exactly($calls))->method('get')->willReturn('label');
     $i = 0;
     $k = array_keys($keys);
     foreach ($k as $key) {
         $i++;
         $fieldMetadataOptions = ['display' => true, 'activity' => true, 'type' => $key, 'field_name' => $key, 'is_collection' => true, 'template' => 'OroActivityListBundle:Merge:value.html.twig', 'label' => 'Items', 'merge_modes' => [MergeModes::ACTIVITY_UNITE, MergeModes::ACTIVITY_REPLACE]];
         $fieldMetadata = new FieldMetadata($fieldMetadataOptions);
         $this->entityMetadata->expects($this->at($i))->method('addFieldMetadata')->with($this->equalTo($fieldMetadata));
     }
     $this->activityManager->expects($this->once())->method('getActivities')->willReturn($keys);
     $event = new EntityMetadataEvent($this->entityMetadata);
     $this->listener->onBuildMetadata($event);
 }