summaryrefslogtreecommitdiffstats
path: root/tests/acceptance
diff options
context:
space:
mode:
Diffstat (limited to 'tests/acceptance')
-rw-r--r--tests/acceptance/features/core/Actor.php22
-rw-r--r--tests/acceptance/features/core/ActorContext.php10
2 files changed, 29 insertions, 3 deletions
diff --git a/tests/acceptance/features/core/Actor.php b/tests/acceptance/features/core/Actor.php
index a27e8e6a015..0c23b5f7a40 100644
--- a/tests/acceptance/features/core/Actor.php
+++ b/tests/acceptance/features/core/Actor.php
@@ -48,6 +48,10 @@
* before giving up without modifying the tests themselves. Note that the
* multiplier affects the timeout, but not the timeout step; the rate at which
* find() will try again to find the element does not change.
+ *
+ * All actors share a notebook in which data can be annotated. This makes
+ * possible to share data between different test steps, no matter which Actor
+ * performs them.
*/
class Actor {
@@ -67,15 +71,22 @@ class Actor {
private $findTimeoutMultiplier;
/**
+ * @var array
+ */
+ private $sharedNotebook;
+
+ /**
* Creates a new Actor.
*
* @param \Behat\Mink\Session $session the Mink Session used to control its
* web browser.
* @param string $baseUrl the base URL used when solving relative URLs.
+ * @param array $sharedNotebook the notebook shared between all actors.
*/
- public function __construct(\Behat\Mink\Session $session, $baseUrl) {
+ public function __construct(\Behat\Mink\Session $session, $baseUrl, &$sharedNotebook) {
$this->session = $session;
$this->baseUrl = $baseUrl;
+ $this->sharedNotebook = &$sharedNotebook;
$this->findTimeoutMultiplier = 1;
}
@@ -221,4 +232,13 @@ class Actor {
return $ancestorElement;
}
+ /**
+ * Returns the shared notebook of the Actors.
+ *
+ * @return array the shared notebook of the Actors.
+ */
+ public function &getSharedNotebook() {
+ return $this->sharedNotebook;
+ }
+
}
diff --git a/tests/acceptance/features/core/ActorContext.php b/tests/acceptance/features/core/ActorContext.php
index 9667ef2f01c..86fe3832f66 100644
--- a/tests/acceptance/features/core/ActorContext.php
+++ b/tests/acceptance/features/core/ActorContext.php
@@ -54,6 +54,11 @@ class ActorContext extends RawMinkContext {
private $actors;
/**
+ * @var array
+ */
+ private $sharedNotebook;
+
+ /**
* @var Actor
*/
private $currentActor;
@@ -102,8 +107,9 @@ class ActorContext extends RawMinkContext {
*/
public function initializeActors() {
$this->actors = array();
+ $this->sharedNotebook = array();
- $this->actors["default"] = new Actor($this->getSession(), $this->getMinkParameter("base_url"));
+ $this->actors["default"] = new Actor($this->getSession(), $this->getMinkParameter("base_url"), $this->sharedNotebook);
$this->actors["default"]->setFindTimeoutMultiplier($this->actorFindTimeoutMultiplier);
$this->currentActor = $this->actors["default"];
@@ -127,7 +133,7 @@ class ActorContext extends RawMinkContext {
*/
public function iActAs($actorName) {
if (!array_key_exists($actorName, $this->actors)) {
- $this->actors[$actorName] = new Actor($this->getSession($actorName), $this->getMinkParameter("base_url"));
+ $this->actors[$actorName] = new Actor($this->getSession($actorName), $this->getMinkParameter("base_url"), $this->sharedNotebook);
$this->actors[$actorName]->setFindTimeoutMultiplier($this->actorFindTimeoutMultiplier);
}