Mink 不切换回会话?
Mink does not switch back sessions?
$driver = clone $this->mink->getSession()->getDriver();
$driver->reset();
$this->mink->registerSession('new', new Session($driver));
$this->mink->setDefaultSessionName('new');
// Do things.
// Switch back to the original.
$this->mink->setDefaultSessionName('default');
好吧,它没有切换回来,我的通过测试变成了失败测试。你可以 see 会话名称最初是 default
。 (这根本不是 Drupal 特定的,因此它实际上不属于 drupal SE。)
不要使用$this->mink->getSession()->getDriver()
使用新的驱动程序:
$session = new Session(new GoutteDriver());
$this->getMink()->registerSession('new', $session);
$driver = clone $this->mink->getSession()->getDriver();
$driver->reset();
$this->mink->registerSession('new', new Session($driver));
$this->mink->setDefaultSessionName('new');
// Do things.
// Switch back to the original.
$this->mink->setDefaultSessionName('default');
好吧,它没有切换回来,我的通过测试变成了失败测试。你可以 see 会话名称最初是 default
。 (这根本不是 Drupal 特定的,因此它实际上不属于 drupal SE。)
不要使用$this->mink->getSession()->getDriver()
使用新的驱动程序:
$session = new Session(new GoutteDriver());
$this->getMink()->registerSession('new', $session);