Пример #1
0
 public function testAddComment()
 {
     $comment = $this->getMock('OroCRM\\Bundle\\CaseBundle\\Entity\\CaseComment');
     $comment->expects($this->once())->method('setCase')->with($this->case);
     $this->assertEquals($this->case, $this->case->addComment($comment));
     $this->assertEquals($comment, $this->case->getComments()->get(0));
 }
Пример #2
0
 public function testGetPhoneNumbers()
 {
     $entity = new CaseEntity();
     $contact = $this->getMockBuilder('OroCRM\\Bundle\\ContactBundle\\Entity\\Contact')->disableOriginalConstructor()->getMock();
     $entity->setRelatedContact($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));
 }
Пример #3
0
 /**
  * Gets a list of all phone numbers available for the given Case object
  *
  * @param CaseEntity $object
  *
  * @return array of [phone number, phone owner]
  */
 public function getPhoneNumbers($object)
 {
     $relatedContact = $object->getRelatedContact();
     if (!$relatedContact) {
         return [];
     }
     return $this->rootProvider->getPhoneNumbers($relatedContact);
 }
Пример #4
0
 /**
  * @param CaseEntity $case
  *
  * @return CaseComment
  */
 public function createComment(CaseEntity $case = null)
 {
     $comment = $this->createCommentObject();
     if ($case) {
         $case->addComment($comment);
     }
     return $comment;
 }
Пример #5
0
 /**
  * @param CaseEntity $case
  */
 public function soapInit($case)
 {
     $this->id = $case->getId();
     $this->subject = $case->getSubject();
     $this->description = $case->getDescription();
     $this->owner = $this->getEntityId($case->getOwner());
     $this->assignedTo = $this->getEntityId($case->getAssignedTo());
     $this->relatedContact = $this->getEntityId($case->getRelatedContact());
     $this->relatedAccount = $this->getEntityId($case->getRelatedAccount());
     $this->source = $case->getSource() ? $case->getSource()->getName() : null;
     $this->status = $case->getStatus() ? $case->getStatus()->getName() : null;
     $this->priority = $case->getPriority() ? $case->getPriority()->getName() : null;
     $this->createdAt = $case->getCreatedAt();
     $this->updatedAt = $case->getUpdatedAt();
     $this->reportedAt = $case->getReportedAt();
     $this->closedAt = $case->getClosedAt();
 }