public function testPreSetData()
 {
     $this->mockConfigs(array('is_granted' => true, 'owner_type' => OwnershipType::OWNER_TYPE_USER));
     $form = $this->getMockBuilder('Symfony\\Component\\Form\\Form')->disableOriginalConstructor()->getMock();
     $form->expects($this->any())->method('getConfig')->will($this->returnValue($this->builder));
     $form->expects($this->any())->method('getParent')->will($this->returnValue(false));
     $form->expects($this->any())->method('has')->will($this->returnValue(true));
     $this->user->expects($this->any())->method('getId')->will($this->returnValue(1));
     $businessUnit = $this->getMockBuilder('Oro\\Bundle\\OrganizationBundle\\Entity\\BusinessUnit')->disableOriginalConstructor()->getMock();
     $this->user->expects($this->any())->method('getOwner')->will($this->returnValue($businessUnit));
     $form->expects($this->once())->method('remove');
     $event = new FormEvent($form, $this->user);
     $this->extension->preSetData($event);
 }
 public function testEventListener()
 {
     $this->mockConfigs(array('is_granted' => false, 'owner_type' => OwnershipType::OWNER_TYPE_ORGANIZATION));
     $this->builder->expects($this->once())->method('addEventSubscriber')->with($this->isInstanceOf('Oro\\Bundle\\OrganizationBundle\\Form\\EventListener\\OwnerFormSubscriber'))->will($this->returnCallback(array($this, 'eventCallback')));
     $this->extension->buildForm($this->builder, array());
 }