* added method to get all parameters from the mink configuration
* added method for setting a single parameter (this is useful for instance if you want to change the base_url context specific)
This commit is contained in:
@@ -47,6 +47,16 @@ class RawMinkContext extends BehatContext implements MinkAwareInterface
|
||||
return $this->mink;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the parameters provided for Mink.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function getMinkParameters()
|
||||
{
|
||||
return $this->minkParameters;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets parameters provided for Mink.
|
||||
*
|
||||
@@ -69,6 +79,18 @@ class RawMinkContext extends BehatContext implements MinkAwareInterface
|
||||
return isset($this->minkParameters[$name]) ? $this->minkParameters[$name] : null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Applies the given parameter to the Mink configuration. Consider that all parameters get reset for each
|
||||
* feature context.
|
||||
*
|
||||
* @param string $name The key of the parameter
|
||||
* @param string $value The value of the parameter
|
||||
*/
|
||||
public function setMinkParameter($name, $value)
|
||||
{
|
||||
$this->minkParameters[$name] = $value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns Mink session.
|
||||
*
|
||||
@@ -111,14 +133,14 @@ class RawMinkContext extends BehatContext implements MinkAwareInterface
|
||||
/**
|
||||
* Save a screenshot of the current window to the file system.
|
||||
*
|
||||
* @param string $filename Desired filename, defaults to
|
||||
* @param string $filename Desired filename, defaults to
|
||||
* <browser_name>_<ISO 8601 date>_<randomId>.png
|
||||
* @param string $filepath Desired filepath, defaults to
|
||||
* @param string $filepath Desired filepath, defaults to
|
||||
* upload_tmp_dir, falls back to sys_get_temp_dir()
|
||||
*/
|
||||
public function saveScreenshot($filename = null, $filepath = null)
|
||||
{
|
||||
// Under Cygwin, uniqid with more_entropy must be set to true.
|
||||
// Under Cygwin, uniqid with more_entropy must be set to true.
|
||||
// No effect in other environments.
|
||||
$filename = $filename ?: sprintf('%s_%s_%s.%s', $this->getMinkParameter('browser_name'), date('c'), uniqid('', true), 'png');
|
||||
$filepath = $filepath ? $filepath : (ini_get('upload_tmp_dir') ? ini_get('upload_tmp_dir') : sys_get_temp_dir());
|
||||
|
||||
Reference in New Issue
Block a user