Explorar o código

[BrowserKit] added getServerParameter method which makes setServerParameters/setServerParameter methods testable

hidenorigoto %!s(int64=14) %!d(string=hai) anos
pai
achega
1d85a3dcb1
Modificáronse 1 ficheiros con 12 adicións e 0 borrados
  1. 12 0
      src/Symfony/Component/BrowserKit/Client.php

+ 12 - 0
src/Symfony/Component/BrowserKit/Client.php

@@ -119,6 +119,18 @@ abstract class Client
         $this->server[$key] = $value;
     }
 
+    /**
+     * Gets single server parameter for specified key.
+     *
+     * @param string $key     A key of the parameter to get
+     * @param string $default A default value when key is undefined
+     * @return string A value of the parameter
+     */
+    public function getServerParameter($key, $default = '')
+    {
+        return (isset($this->server[$key])) ? $this->server[$key] : $default;
+    }
+
     /**
      * Returns the History instance.
      *