Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

API remove base_url context parameter

use MinkExtension base_url instead
  • Loading branch information...
commit c1a078e76a43e5cc069661bf25cde80d2dc89e59 1 parent 07eba2f
Michał Ochman authored
1  behat.yml
@@ -2,7 +2,6 @@
2 2 default:
3 3 context:
4 4 parameters:
5   - base_url: http://localhost
6 5 admin_url: /admin/
7 6 login_url: /Security/login
8 7 screenshot_path: features/screenshots/
2  features/bootstrap/SilverStripe/Test/Behaviour/BasicContext.php
@@ -188,7 +188,7 @@ public function stepIShouldBeRedirectedTo($url)
188 188 $client->followRedirects(true);
189 189 $client->followRedirect();
190 190
191   - $url = $this->getMainContext()->joinUrlParts($this->context['base_url'], $url);
  191 + $url = $this->getMainContext()->joinUrlParts($this->getMainContext()->getBaseUrl(), $url);
192 192
193 193 assertTrue($this->getMainContext()->isCurrentUrlSimilarTo($url), sprintf('Current URL is not %s', $url));
194 194 }
6 features/bootstrap/SilverStripe/Test/Behaviour/LoginContext.php
@@ -53,8 +53,8 @@ public function getSession($name = null)
53 53 */
54 54 public function stepIAmLoggedIn()
55 55 {
56   - $admin_url = $this->getMainContext()->joinUrlParts($this->context['base_url'], $this->context['admin_url']);
57   - $login_url = $this->getMainContext()->joinUrlParts($this->context['base_url'], $this->context['login_url']);
  56 + $admin_url = $this->getMainContext()->joinUrlParts($this->getMainContext()->getBaseUrl(), $this->context['admin_url']);
  57 + $login_url = $this->getMainContext()->joinUrlParts($this->getMainContext()->getBaseUrl(), $this->context['login_url']);
58 58
59 59 $this->getSession()->visit($admin_url);
60 60
@@ -111,7 +111,7 @@ public function stepIAmNotLoggedIn()
111 111 */
112 112 public function stepILogInWith($email, $password)
113 113 {
114   - $login_url = $this->getMainContext()->joinUrlParts($this->context['base_url'], $this->context['login_url']);
  114 + $login_url = $this->getMainContext()->joinUrlParts($this->getMainContext()->getBaseUrl(), $this->context['login_url']);
115 115
116 116 $this->getSession()->visit($login_url);
117 117
14 features/bootstrap/SilverStripe/Test/Behaviour/SilverStripeContext.php
@@ -74,7 +74,7 @@ public function before(ScenarioEvent $event)
74 74 throw new \LogicException('Context\'s $database_name has to be set when implementing SilverStripeAwareContextInterface.');
75 75 }
76 76
77   - $setdb_url = $this->joinUrlParts($this->context['base_url'], '/dev/tests/setdb');
  77 + $setdb_url = $this->joinUrlParts($this->getBaseUrl(), '/dev/tests/setdb');
78 78 $setdb_url = sprintf('%s?database=%s', $setdb_url, $this->database_name);
79 79 $this->getSession()->visit($setdb_url);
80 80 }
@@ -299,6 +299,18 @@ public function isCurrentUrlSimilarTo($url)
299 299 }
300 300
301 301 /**
  302 + * Returns base URL parameter set in MinkExtension.
  303 + * It simplifies configuration by allowing to specify this parameter
  304 + * once but makes code dependent on MinkExtension.
  305 + *
  306 + * @return string
  307 + */
  308 + public function getBaseUrl()
  309 + {
  310 + return $this->getMinkParameter('base_url') ?: '';
  311 + }
  312 +
  313 + /**
302 314 * Joins URL parts into an URL using forward slash.
303 315 * Forward slash usages are normalised to one between parts.
304 316 * This method takes variable number of parameters.

0 comments on commit c1a078e

Please sign in to comment.
Something went wrong with that request. Please try again.