Skip to content

Commit

Permalink
Merge pull request #145 from jhedstrom/various-cleanup
Browse files Browse the repository at this point in the history
Various cleanup

Signed-off-by: Jonathan Hedstrom <jhedstrom@gmail.com>
  • Loading branch information
jhedstrom committed Feb 23, 2015
1 parent aa0d4ee commit c85b14c
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 6 deletions.
2 changes: 1 addition & 1 deletion src/Drupal/DrupalExtension/Context/DrupalContext.php
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ public function assertLoggedInWithPermissions($permissions) {
*/
public function getTableRow(Element $element, $search) {
$rows = $element->findAll('css', 'tr');
if (!$rows) {
if (empty($rows)) {
throw new \Exception(sprintf('No rows found on the page %s', $this->getSession()->getCurrentUrl()));
}
foreach ($rows as $row) {
Expand Down
2 changes: 0 additions & 2 deletions src/Drupal/DrupalExtension/Context/MessageContext.php
Original file line number Diff line number Diff line change
Expand Up @@ -275,7 +275,6 @@ private function _assert($message, $selectorId, $exceptionMsgNone, $exceptionMsg
throw new \Exception(sprintf($exceptionMsgNone, $this->getSession()->getCurrentUrl()));
}
foreach ($selectorObjects as $selectorObject) {
$text = $selectorObject->getText();
if (strpos(trim($selectorObject->getText()), $message) !== FALSE) {
return;
}
Expand All @@ -300,7 +299,6 @@ private function _assertNot($message, $selectorId, $exceptionMsg) {
$selectorObjects = $this->getSession()->getPage()->findAll("css", $selector);
if (!empty($selectorObjects)) {
foreach ($selectorObjects as $selectorObject) {
$text = $selectorObject->getText();
if (strpos(trim($selectorObject->getText()), $message) !== FALSE) {
throw new \Exception(sprintf($exceptionMsg, $this->getSession()->getCurrentUrl(), $message));
}
Expand Down
6 changes: 3 additions & 3 deletions src/Drupal/DrupalExtension/Context/RawDrupalContext.php
Original file line number Diff line number Diff line change
Expand Up @@ -54,9 +54,9 @@ class RawDrupalContext extends RawMinkContext implements DrupalAwareInterface {
*
* A value of FALSE denotes an anonymous user.
*
* @var mixed
* @var stdClass|bool
*/
protected $user = FALSE;
public $user = FALSE;

/**
* Keep track of all users that are created so they can easily be removed.
Expand Down Expand Up @@ -247,7 +247,6 @@ public function nodeCreate($node) {
* @param $entity
*/
public function parseEntityFields($entity_type, $entity) {
$values = array();
foreach ($entity as $field_name => $value) {
if ($this->getDriver()->isField($entity_type, $field_name)) {
$values = explode(', ', $value);
Expand Down Expand Up @@ -356,4 +355,5 @@ public function loggedIn() {
public function loggedInWithRole($role) {
return $this->loggedIn() && $this->user && isset($this->user->role) && $this->user->role == $role;
}

}

0 comments on commit c85b14c

Please sign in to comment.