Symfony2测试中的会话

时间:2016-09-20 11:29:24

标签: php symfony session functional-testing

我需要在这些视图中获取session_id,因为它存储在数据库中。我使用Symfony \ Bundle \ FrameworkBundle \ Client。

当我尝试这样的事情时:

$cookies = $client->getCookieJar()->all(self::BASE_URL.$ltiLoginUrl); foreach ($cookies as $cookie) { var_dump($cookie); }

我得到了这样的输出:

class Symfony\Component\BrowserKit\Cookie#11238 (8) {
  protected $name =>
  string(10) "MOCKSESSID"
  protected $value =>
  string(64) "9d2b2a5b307c3e330dc4407a6e0a109f57008128614a85056479731ee5284157"
  protected $expires =>
  int(0)
  protected $path =>
  string(1) "/"
  protected $domain =>
  string(9) "localhost"
  protected $secure =>
  bool(false)
  protected $httponly =>
  bool(false)
  protected $rawValue =>
  string(64) "9d2b2a5b307c3e330dc4407a6e0a109f57008128614a85056479731ee5284157"
}

我的问题是如何在这种情况下获得真正的会话ID?

谢谢。

0 个答案:

没有答案