Skip to content
This repository has been archived by the owner on Nov 9, 2017. It is now read-only.

Commit

Permalink
fixed conditions CS
Browse files Browse the repository at this point in the history
  • Loading branch information
everzet committed Dec 21, 2011
1 parent d6d2782 commit 59cd4d2
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 11 deletions.
20 changes: 10 additions & 10 deletions src/Behat/Mink/Driver/Selenium2Driver.php
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ protected function setBrowserName($browserName = 'firefox')
*/ */
public function setDesiredCapabilities($desiredCapabilities = null) public function setDesiredCapabilities($desiredCapabilities = null)
{ {
if ( $desiredCapabilities === null ) { if ($desiredCapabilities === null) {
$desiredCapabilities = self::getDefaultCapabilities(); $desiredCapabilities = self::getDefaultCapabilities();
} }
$this->desiredCapabilities = $desiredCapabilities; $this->desiredCapabilities = $desiredCapabilities;
Expand Down Expand Up @@ -116,7 +116,7 @@ protected static function getDefaultCapabilities()
protected function withSyn() protected function withSyn()
{ {
$hasSyn = $this->wdSession->execute(array('script'=>'return typeof window["Syn"]!=="undefined"', 'args'=>array())); $hasSyn = $this->wdSession->execute(array('script'=>'return typeof window["Syn"]!=="undefined"', 'args'=>array()));
if ( !$hasSyn ) { if (!$hasSyn) {
$synJs = file_get_contents(dirname(__FILE__) . DIRECTORY_SEPARATOR . 'Selenium2' . DIRECTORY_SEPARATOR . 'syn.js'); $synJs = file_get_contents(dirname(__FILE__) . DIRECTORY_SEPARATOR . 'Selenium2' . DIRECTORY_SEPARATOR . 'syn.js');
$this->wdSession->execute(array('script'=>$synJs, 'args'=>array())); $this->wdSession->execute(array('script'=>$synJs, 'args'=>array()));
} }
Expand All @@ -132,7 +132,7 @@ protected function withSyn()
*/ */
protected static function charToOptions($event, $char, $modifier=null) protected static function charToOptions($event, $char, $modifier=null)
{ {
if ( is_numeric($char) ) { if (is_numeric($char)) {
$ord = $char; $ord = $char;
$char = chr($char); $char = chr($char);
} else { } else {
Expand All @@ -142,7 +142,7 @@ protected static function charToOptions($event, $char, $modifier=null)
'keyCode' => $ord, 'keyCode' => $ord,
'charCode' => $ord 'charCode' => $ord
); );
if ( $modifier ) { if ($modifier) {
$options[$modifier.'Key'] = 1; $options[$modifier.'Key'] = 1;
} }
$json = json_encode($options); $json = json_encode($options);
Expand Down Expand Up @@ -183,7 +183,7 @@ public function setSession(Session $session)
public function start() public function start()
{ {
$this->wdSession = $this->webDriver->session($this->browserName, $this->desiredCapabilities); $this->wdSession = $this->webDriver->session($this->browserName, $this->desiredCapabilities);
if ( !$this->wdSession ) { if (!$this->wdSession) {
throw new DriverException('Could not connect to a Selenium 2 / WebDriver server'); throw new DriverException('Could not connect to a Selenium 2 / WebDriver server');
} }
$this->started = true; $this->started = true;
Expand All @@ -204,7 +204,7 @@ public function isStarted()
*/ */
public function stop() public function stop()
{ {
if ( !$this->wdSession ) { if (!$this->wdSession) {
throw new DriverException('Could not connect to a Selenium 2 / WebDriver server'); throw new DriverException('Could not connect to a Selenium 2 / WebDriver server');
} }
$this->started = false; $this->started = false;
Expand Down Expand Up @@ -304,7 +304,7 @@ public function getResponseHeaders()
*/ */
public function setCookie($name, $value = null) public function setCookie($name, $value = null)
{ {
if ( $value !== null ) { if ($value !== null) {
$cookieArray = array( $cookieArray = array(
'name' => $name, 'name' => $name,
'value' => (string) $value, 'value' => (string) $value,
Expand All @@ -327,7 +327,7 @@ public function getCookie($name)
{ {
$cookies = $this->wdSession->getAllCookies(); $cookies = $this->wdSession->getAllCookies();
foreach ( $cookies as $cookie ) { foreach ( $cookies as $cookie ) {
if ( $cookie['name'] === $name ) { if ($cookie['name'] === $name) {
return $cookie['value']; return $cookie['value'];
} }
} }
Expand Down Expand Up @@ -368,7 +368,7 @@ public function find($xpath)
foreach ( $nodes as $i => $node ) { foreach ( $nodes as $i => $node ) {
$elements[] = new NodeElement(sprintf('(%s)[%d]', $xpath, $i+1), $this->session); $elements[] = new NodeElement(sprintf('(%s)[%d]', $xpath, $i+1), $this->session);
} }
if ( !empty($elements) ) { if (!empty($elements)) {
return $elements; return $elements;
} }
} }
Expand Down Expand Up @@ -423,7 +423,7 @@ public function getHtml($xpath)
public function getAttribute($xpath, $attr) public function getAttribute($xpath, $attr)
{ {
$attribute = $this->wdSession->element('xpath', $xpath)->attribute($attr); $attribute = $this->wdSession->element('xpath', $xpath)->attribute($attr);
if ( $attribute !== '' ) { if ($attribute !== '') {
return $attribute; return $attribute;
} }
} }
Expand Down
1 change: 0 additions & 1 deletion tests/Behat/Mink/Driver/Selenium2DriverTest.php
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -33,5 +33,4 @@ public function testOtherMouseEvents()
$clicker->mouseOver(); $clicker->mouseOver();
$this->assertEquals('mouse overed', $clicker->getText()); $this->assertEquals('mouse overed', $clicker->getText());
} }

} }

0 comments on commit 59cd4d2

Please sign in to comment.