Пример #1
0
 public function testLeadsInteraction()
 {
     $result = $this->entity->getLeads();
     $this->assertInstanceOf('Doctrine\\Common\\Collections\\ArrayCollection', $result);
     $this->assertCount(0, $result);
     $lead = $this->getMock('OroCRM\\Bundle\\SalesBundle\\Entity\\Lead');
     $this->entity->addLead($lead);
     $this->assertCount(1, $this->entity->getLeads());
     $this->assertTrue($this->entity->getLeads()->contains($lead));
     $this->entity->removeLead($lead);
     $result = $this->entity->getLeads();
     $this->assertCount(0, $result);
     $newCollection = new ArrayCollection();
     $this->entity->setLeads($newCollection);
     $this->assertNotSame($result, $this->entity->getLeads());
     $this->assertSame($newCollection, $this->entity->getLeads());
 }
Пример #2
0
 /**
  * Remove leads from B2bCustomer
  *
  * @param B2bCustomer $b2bCustomer
  * @param Lead[]      $leads
  */
 protected function removeLeads(B2bCustomer $b2bCustomer, array $leads)
 {
     foreach ($leads as $lead) {
         $b2bCustomer->removeLead($lead);
     }
 }