|
@@ 92-111 (lines=20) @@
|
| 89 |
|
$this->assertLessThan(3, $this->entity->getUpdatedAt()->diff(new \DateTime())->s); |
| 90 |
|
} |
| 91 |
|
|
| 92 |
|
public function testLeadsInteraction() |
| 93 |
|
{ |
| 94 |
|
$result = $this->entity->getLeads(); |
| 95 |
|
$this->assertInstanceOf('Doctrine\Common\Collections\ArrayCollection', $result); |
| 96 |
|
$this->assertCount(0, $result); |
| 97 |
|
|
| 98 |
|
$lead = $this->getMock('OroCRM\Bundle\SalesBundle\Entity\Lead'); |
| 99 |
|
$this->entity->addLead($lead); |
| 100 |
|
$this->assertCount(1, $this->entity->getLeads()); |
| 101 |
|
$this->assertTrue($this->entity->getLeads()->contains($lead)); |
| 102 |
|
|
| 103 |
|
$this->entity->removeLead($lead); |
| 104 |
|
$result = $this->entity->getLeads(); |
| 105 |
|
$this->assertCount(0, $result); |
| 106 |
|
|
| 107 |
|
$newCollection = new ArrayCollection(); |
| 108 |
|
$this->entity->setLeads($newCollection); |
| 109 |
|
$this->assertNotSame($result, $this->entity->getLeads()); |
| 110 |
|
$this->assertSame($newCollection, $this->entity->getLeads()); |
| 111 |
|
} |
| 112 |
|
|
| 113 |
|
public function testOpportunitiesInteraction() |
| 114 |
|
{ |
|
@@ 113-132 (lines=20) @@
|
| 110 |
|
$this->assertSame($newCollection, $this->entity->getLeads()); |
| 111 |
|
} |
| 112 |
|
|
| 113 |
|
public function testOpportunitiesInteraction() |
| 114 |
|
{ |
| 115 |
|
$result = $this->entity->getOpportunities(); |
| 116 |
|
$this->assertInstanceOf('Doctrine\Common\Collections\ArrayCollection', $result); |
| 117 |
|
$this->assertCount(0, $result); |
| 118 |
|
|
| 119 |
|
$opportunity = $this->getMock('OroCRM\Bundle\SalesBundle\Entity\Opportunity'); |
| 120 |
|
$this->entity->addOpportunity($opportunity); |
| 121 |
|
$this->assertCount(1, $this->entity->getOpportunities()); |
| 122 |
|
$this->assertTrue($this->entity->getOpportunities()->contains($opportunity)); |
| 123 |
|
|
| 124 |
|
$this->entity->removeOpportunity($opportunity); |
| 125 |
|
$result = $this->entity->getLeads(); |
| 126 |
|
$this->assertCount(0, $result); |
| 127 |
|
|
| 128 |
|
$newCollection = new ArrayCollection(); |
| 129 |
|
$this->entity->setOpportunities($newCollection); |
| 130 |
|
$this->assertNotSame($result, $this->entity->getOpportunities()); |
| 131 |
|
$this->assertSame($newCollection, $this->entity->getOpportunities()); |
| 132 |
|
} |
| 133 |
|
|
| 134 |
|
public function testToSting() |
| 135 |
|
{ |