Ejemplo n.º 1
0
 /**
  * @param \Behat\Mink\Session $session
  * @return JR_Mink_Test_Mink
  */
 protected function _initSession($session)
 {
     switch (php_sapi_name()) {
         case 'cli':
             $lang = $_SERVER['LANG'];
             if ($lang) {
                 $pieces = explode('.', $lang);
                 $lang = $pieces[0];
             }
             break;
         case 'cgi':
         case 'cgi-fcgi':
         case 'apache':
         case 'apache2handler':
         case 'phttpd':
         case 'thttpd':
             $lang = $_SERVER['HTTP_ACCEPT_LANGUAGE'];
             break;
         default:
             $lang = null;
     }
     if ($lang) {
         try {
             $session->setRequestHeader('Accept-Language', $lang);
         } catch (\Behat\Mink\Exception\UnsupportedDriverActionException $e) {
             $this->getRenderer()->error($e->getMessage());
         }
     }
     return $this;
 }
Ejemplo n.º 2
0
 public function _setHeader($header, $value)
 {
     $this->session->setRequestHeader($header, $value);
 }
Ejemplo n.º 3
0
 public function testSetRequestHeader()
 {
     $this->driver->expects($this->once())->method('setRequestHeader')->with('name', 'value');
     $this->session->setRequestHeader('name', 'value');
 }
 /**
  * @Given the client's browser is sending out the user agent :userAgent
  */
 public function theClientsBrowserIsSendingOutTheLocale($userAgent)
 {
     $this->session->setRequestHeader('User-Agent', $userAgent);
 }