コード例 #1
0
 /**
  * Initializes session strategy using given browser test case.
  *
  * @param BrowserConfiguration $browser Browser configuration.
  *
  * @return ISessionStrategy
  */
 public function getSessionStrategy(BrowserConfiguration $browser)
 {
     /*
      * This logic creates separate strategy for:
      * - each browser configuration in BrowserTestCase::$browsers (for isolated strategy)
      * - each browser configuration in BrowserTestCase::$browsers for each test case class (for shared strategy)
      */
     $strategy_type = $browser->getSessionStrategy();
     $strategy_hash = $browser->getSessionStrategyHash();
     if ($strategy_hash !== $this->lastUsedSessionStrategyHash) {
         $this->sessionStrategiesInUse[$strategy_hash] = $this->_sessionStrategyFactory->createStrategy($strategy_type);
     }
     $this->lastUsedSessionStrategyHash = $strategy_hash;
     return $this->sessionStrategiesInUse[$strategy_hash];
 }