Ejemplo n.º 1
0
 /**
  * @param Opportunity $opportunity
  * @param bool        $takeZeroRevenue
  *
  * @return bool
  */
 protected function isValuable(Opportunity $opportunity, $takeZeroRevenue = false)
 {
     return $opportunity->getCustomer() && $opportunity->getStatus() && $opportunity->getStatus()->getName() === B2bCustomerRepository::VALUABLE_STATUS && ($takeZeroRevenue || $opportunity->getCloseRevenue() > 0);
 }
 /**
  * @depends testCustomerChangeShouldUpdateBothCustomersIfValuable
  *
  * @param Opportunity $opportunity
  *
  * @return Opportunity
  */
 public function testRemoveSubtractLifetime(Opportunity $opportunity)
 {
     $em = $this->getEntityManager();
     $b2bCustomer = $opportunity->getCustomer();
     $em->remove($opportunity);
     $em->flush();
     $em->refresh($b2bCustomer);
     $this->assertEquals(0, $b2bCustomer->getLifetime());
     return $opportunity;
 }