public function loginTo(UserInterface $User)
{
$firewall = 'admin';
$role = array('ROLE_ADMIN');
if ($User instanceof \Eccube\Entity\Customer) {
$firewall = 'customer';
$role = array('ROLE_USER');
}
$token = new UsernamePasswordToken($User, null, $firewall, $role);
$this->app['security.token_storage']->setToken($token);
$this->app['session']->set('_security_' . $firewall, serialize($token));
$this->app['session']->save();
$cookie = new Cookie($this->app['session']->getName(), $this->app['session']->getId());
$this->client->getCookieJar()->set($cookie);
return $this->client;
}