public function testUserWithInvalidUser() { $request = Request::create('/'); $app = new \Eccube\Application(); $app['security'] = $this->getMockBuilder('Symfony\\Component\\Security\\Core\\SecurityContext')->disableOriginalConstructor()->getMock(); $token = $this->getMockBuilder('Symfony\\Component\\Security\\Core\\Authentication\\Token\\UsernamePasswordToken')->disableOriginalConstructor()->getMock(); $token->expects($this->once())->method('getUser')->will($this->returnValue(array())); $app['security']->expects($this->any())->method('getToken')->will($this->returnValue($token)); $app->get('/', function () { return 'foo'; }); $app->handle($request); $this->assertNull($app->user()); }