public function testBuildFullEmailAddress()
 {
     $user = $this->getMock('Oro\\Bundle\\UserBundle\\Entity\\User');
     $email = 'email';
     $format = 'format';
     $expected = 'format <email>';
     $user->expects($this->once())->method('getEmail')->willReturn($email);
     $this->entityNameResolver->expects($this->once())->method('getName')->with($user)->willReturn($format);
     $result = $this->helper->buildFullEmailAddress($user);
     $this->assertEquals($expected, $result);
 }
 /**
  * @param EmailModel $emailModel
  */
 protected function applyFrom(EmailModel $emailModel)
 {
     if (!$emailModel->getFrom()) {
         if ($this->request->query->has('from')) {
             $from = $this->request->query->get('from');
             if (!empty($from)) {
                 $this->helper->preciseFullEmailAddress($from);
             }
             $emailModel->setFrom($from);
         } else {
             $user = $this->helper->getUser();
             if ($user) {
                 $emailModel->setFrom($this->helper->buildFullEmailAddress($user));
             }
         }
     }
 }