public function testProcessGetRequest() { $this->request->setMethod('GET'); $this->request->query->set('gridName', 'testGrid'); $this->request->query->set('from', '*****@*****.**'); $this->request->query->set('to', '*****@*****.**'); $this->request->query->set('subject', 'testSubject'); $this->nameFormatter->expects($this->any())->method('format')->with($this->isInstanceOf('Oro\\Bundle\\EmailBundle\\Tests\\Unit\\Fixtures\\Entity\\TestUser'))->will($this->returnValue('FirstName LastName')); $this->form->expects($this->once())->method('setData')->with($this->model); $this->form->expects($this->never())->method('submit'); $this->assertFalse($this->handler->process($this->model)); $this->assertEquals('testGrid', $this->model->getGridName()); $this->assertEquals('FirstName LastName <*****@*****.**>', $this->model->getFrom()); $this->assertEquals(array('FirstName LastName <*****@*****.**>'), $this->model->getTo()); $this->assertEquals('testSubject', $this->model->getSubject()); }
/** * @param EmailModel $model * @param \DateTime $messageDate * @param EmailOrigin $origin * * @return EmailUser */ protected function createEmailUser(EmailModel $model, $messageDate, EmailOrigin $origin) { $emailUser = $this->emailEntityBuilder->emailUser($model->getSubject(), $model->getFrom(), $model->getTo(), $messageDate, $messageDate, $messageDate, Email::NORMAL_IMPORTANCE, $model->getCc(), $model->getBcc(), $origin->getOwner(), $origin->getOrganization()); if ($origin instanceof UserEmailOrigin && $origin->getMailbox() !== null) { $emailUser->setOwner(null); $emailUser->setMailboxOwner($origin->getMailbox()); } return $emailUser; }