src/CentraleLille/DemoBundle/Tests/Service/DemoServiceTest.php
/**
     * Test Get User
     *
     * Description function
     *
     * @return something
     */
Test Get User
Description function

@return something
Test Get User Description function @return something
public function testGetUser()
    {
        $anonymousMock = $this->getMockBuilder('Symfony\Component\Security\Core\Authentication\Token\AnonymousToken')
            ->disableOriginalConstructor()->getMock();
        $anonymousMock->method('getUser')->will($this->returnValue(false));
        $mock = $this->getMock('Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorage');
        $mock->expects($this->once())->method('getToken')->will($this->returnValue($anonymousMock));
        $demoService = new DemoService($mock);
        $demoService->getUser();
    }
public function testGetUser ( ) { $ anonymousMock = $ this -> getMockBuilder ( 'Symfony\Component\Security\Core\Authentication\Token\AnonymousToken' ) -> disableOriginalConstructor ( ) -> getMock ( ) ; $ anonymousMock -> method ( 'getUser' ) -> will ( $ this -> returnValue ( false ) ) ; $ mock = $ this -> getMock ( 'Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorage' ) ; $ mock -> expects ( $ this -> once ( ) ) -> method ( 'getToken' ) -> will ( $ this -> returnValue ( $ anonymousMock ) ) ; $ demoService = new DemoService ( $ mock ) ; $ demoService -> getUser ( ) ; }
Test Get User
 Description function
Test Get User Description function
//mock the anonymous token //mock the token Storage