Ejemplo n.º 1
0
 /**
  * @param string      $key
  * @param B2bCustomer $entity
  */
 public function fillEntityData($key, $entity)
 {
     $addressRepo = $this->templateManager->getEntityRepository('Oro\\Bundle\\AddressBundle\\Entity\\Address');
     $userRepo = $this->templateManager->getEntityRepository('Oro\\Bundle\\UserBundle\\Entity\\User');
     $contactRepo = $this->templateManager->getEntityRepository('OroCRM\\Bundle\\ContactBundle\\Entity\\Contact');
     $leadRepo = $this->templateManager->getEntityRepository('OroCRM\\Bundle\\SalesBundle\\Entity\\Lead');
     $accountRepo = $this->templateManager->getEntityRepository('OroCRM\\Bundle\\AccountBundle\\Entity\\Account');
     $channelRepo = $this->templateManager->getEntityRepository('OroCRM\\Bundle\\ChannelBundle\\Entity\\Channel');
     $opportunityRepo = $this->templateManager->getEntityRepository('OroCRM\\Bundle\\SalesBundle\\Entity\\Opportunity');
     switch ($key) {
         case 'Jerry Coleman':
             $entity->setName('Jerry Coleman');
             $entity->addLead($leadRepo->getEntity('Jerry Coleman'));
             $entity->setContact($contactRepo->getEntity('Jerry Coleman'));
             $entity->setAccount($accountRepo->getEntity('Coleman'));
             $entity->setOwner($userRepo->getEntity('John Doo'));
             $entity->setBillingAddress($addressRepo->getEntity('Jerry Coleman'));
             $entity->setShippingAddress($addressRepo->getEntity('Jerry Coleman'));
             $entity->setDataChannel($channelRepo->getEntity('B2B channel|b2b'));
             $entity->setCreatedAt(new \DateTime());
             $entity->setUpdatedAt(new \DateTime());
             $entity->addOpportunity($opportunityRepo->getEntity('Jerry Coleman'));
             return;
     }
     parent::fillEntityData($key, $entity);
 }
Ejemplo n.º 2
0
 public function testGetPhoneNumbers()
 {
     $entity = new B2bCustomer();
     $contact = $this->getMockBuilder('OroCRM\\Bundle\\ContactBundle\\Entity\\Contact')->disableOriginalConstructor()->getMock();
     $entity->setContact($contact);
     $this->rootProvider->expects($this->once())->method('getPhoneNumbers')->with($this->identicalTo($contact))->will($this->returnValue([['123-123', $contact], ['456-456', $contact]]));
     $this->assertEquals([['123-123', $contact], ['456-456', $contact]], $this->provider->getPhoneNumbers($entity));
 }
Ejemplo n.º 3
0
 public function testGetEmail()
 {
     $account = $this->getMockBuilder('OroCRM\\Bundle\\AccountBundle\\Entity\\Account')->disableOriginalConstructor()->getMock();
     $contact = $this->getMockBuilder('OroCRM\\Bundle\\ContactBundle\\Entity\\Contact')->disableOriginalConstructor()->getMock();
     $this->assertNull($this->entity->getEmail());
     $this->entity->setAccount($account);
     $account->expects($this->once())->method('getEmail')->will($this->returnValue('*****@*****.**'));
     $this->assertEquals('*****@*****.**', $this->entity->getEmail());
     $this->entity->setContact($contact);
     $contact->expects($this->once())->method('getEmail')->will($this->returnValue('*****@*****.**'));
     $this->assertEquals('*****@*****.**', $this->entity->getEmail());
 }