General Coding Convention Changes

This commit is contained in:
Sriram Venkatesh 2014-01-27 10:50:20 +13:00
parent f5957a0586
commit 26f47d9d58

View File

@ -68,76 +68,62 @@ class SilverStripeContext extends MinkContext implements SilverStripeAwareContex
*
* @param array $parameters context parameters (set them up through behat.yml)
*/
public function __construct(array $parameters)
{
public function __construct(array $parameters) {
// Initialize your context here
$this->context = $parameters;
}
public function setDatabase($databaseName)
{
public function setDatabase($databaseName) {
$this->databaseName = $databaseName;
}
public function setAjaxSteps($ajaxSteps)
{
public function setAjaxSteps($ajaxSteps) {
if($ajaxSteps) $this->ajaxSteps = $ajaxSteps;
}
public function getAjaxSteps()
{
public function getAjaxSteps() {
return $this->ajaxSteps;
}
public function setAjaxTimeout($ajaxTimeout)
{
public function setAjaxTimeout($ajaxTimeout) {
$this->ajaxTimeout = $ajaxTimeout;
}
public function getAjaxTimeout()
{
public function getAjaxTimeout() {
return $this->ajaxTimeout;
}
public function setAdminUrl($adminUrl)
{
public function setAdminUrl($adminUrl) {
$this->adminUrl = $adminUrl;
}
public function getAdminUrl()
{
public function getAdminUrl() {
return $this->adminUrl;
}
public function setLoginUrl($loginUrl)
{
public function setLoginUrl($loginUrl) {
$this->loginUrl = $loginUrl;
}
public function getLoginUrl()
{
public function getLoginUrl() {
return $this->loginUrl;
}
public function setScreenshotPath($screenshotPath)
{
public function setScreenshotPath($screenshotPath) {
$this->screenshotPath = $screenshotPath;
}
public function getScreenshotPath()
{
public function getScreenshotPath() {
return $this->screenshotPath;
}
/**
* @BeforeScenario
*/
public function before(ScenarioEvent $event)
{
public function before(ScenarioEvent $event) {
if (!isset($this->databaseName)) {
throw new \LogicException(
'Context\'s $databaseName has to be set when implementing '
. 'SilverStripeAwareContextInterface.'
'Context\'s $databaseName has to be set when implementing SilverStripeAwareContextInterface.'
);
}
@ -183,8 +169,7 @@ class SilverStripeContext extends MinkContext implements SilverStripeAwareContex
* @param $url
* @return array|mixed Parsed URL
*/
public function parseUrl($url)
{
public function parseUrl($url) {
$url = parse_url($url);
$url['vars'] = array();
if (!isset($url['fragment'])) {
@ -205,8 +190,7 @@ class SilverStripeContext extends MinkContext implements SilverStripeAwareContex
* @param $url string URL to compare to current URL
* @return boolean Returns true if the current URL is close enough to the given URL, false otherwise.
*/
public function isCurrentUrlSimilarTo($url)
{
public function isCurrentUrlSimilarTo($url) {
$current = $this->parseUrl($this->getSession()->getCurrentUrl());
$test = $this->parseUrl($url);
@ -234,8 +218,7 @@ class SilverStripeContext extends MinkContext implements SilverStripeAwareContex
*
* @return string
*/
public function getBaseUrl()
{
public function getBaseUrl() {
return $this->getMinkParameter('base_url') ?: '';
}
@ -248,8 +231,7 @@ class SilverStripeContext extends MinkContext implements SilverStripeAwareContex
* @return string
* @throws \InvalidArgumentException
*/
public function joinUrlParts()
{
public function joinUrlParts() {
if (0 === func_num_args()) {
throw new \InvalidArgumentException('Need at least one argument');
}
@ -263,8 +245,7 @@ class SilverStripeContext extends MinkContext implements SilverStripeAwareContex
return implode('/', $parts);
}
public function canIntercept()
{
public function canIntercept() {
$driver = $this->getSession()->getDriver();
if ($driver instanceof GoutteDriver) {
return true;
@ -275,14 +256,14 @@ class SilverStripeContext extends MinkContext implements SilverStripeAwareContex
}
}
throw new UnsupportedDriverActionException('You need to tag the scenario with "@mink:goutte" or "@mink:symfony". Intercepting the redirections is not supported by %s', $driver);
throw new UnsupportedDriverActionException('You need to tag the scenario with "@mink:goutte" or
"@mink:symfony". Intercepting the redirections is not supported by %s', $driver);
}
/**
* @Given /^(.*) without redirection$/
*/
public function theRedirectionsAreIntercepted($step)
{
public function theRedirectionsAreIntercepted($step) {
if ($this->canIntercept()) {
$this->getSession()->getDriver()->getClient()->followRedirects(false);
}
@ -294,8 +275,7 @@ class SilverStripeContext extends MinkContext implements SilverStripeAwareContex
* Fills in form field with specified id|name|label|value.
* Overwritten to select the first *visible* element, see https://github.com/Behat/Mink/issues/311
*/
public function fillField($field, $value)
{
public function fillField($field, $value) {
$value = $this->fixStepArgument($value);
$fields = $this->getSession()->getPage()->findAll('named', array(
'field', $this->getSession()->getSelectorsHandler()->xpathLiteral($field)
@ -315,8 +295,7 @@ class SilverStripeContext extends MinkContext implements SilverStripeAwareContex
/**
* Overwritten to click the first *visable* link the DOM.
*/
public function clickLink($link)
{
public function clickLink($link) {
$link = $this->fixStepArgument($link);
$links = $this->getSession()->getPage()->findAll('named', array(
'link', $this->getSession()->getSelectorsHandler()->xpathLiteral($link)