/** * @param object $user * @param mixed $expected * * @dataProvider getUserProvider */ public function testGetUserTokenIsNotNull($user, $expected) { $token = $this->getMock('Symfony\\Component\\Security\\Core\\Authentication\\Token\\TokenInterface'); $this->securityContext->expects($this->once())->method('getToken')->willReturn($token); $token->expects($this->once())->method('getUser')->willReturn($user); $result = $this->helper->getUser(); $this->assertEquals($expected, $result); }
/** * @param EmailModel $emailModel * @param EmailEntity $emailEntity */ protected function applyEntityDataFromEmail(EmailModel $emailModel, EmailEntity $emailEntity) { $entities = $emailEntity->getActivityTargetEntities(); foreach ($entities as $entity) { if ($entity != $this->helper->getUser()) { $emailModel->setEntityClass(ClassUtils::getClass($entity)); $emailModel->setEntityId($entity->getId()); return; } } }
/** * @param object $user * @param mixed $expected * * @dataProvider getUserProvider */ public function testGetUser($user) { $this->securityFacade->expects($this->once())->method('getLoggedUser')->willReturn($user); $result = $this->helper->getUser(); $this->assertSame($user, $result); }