Symfony2测试中的会话

问题描述 投票:0回答:0

我需要在这些视图中获取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?

谢谢。

php symfony session functional-testing
© www.soinside.com 2019 - 2024. All rights reserved.