/** * @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); }