Skip to content
This repository has been archived by the owner on May 3, 2022. It is now read-only.

Commit

Permalink
[Behat] Fix User edit sentence fetches the first and last name of the…
Browse files Browse the repository at this point in the history
… User to select from the conten tree
  • Loading branch information
Miguel committed Apr 26, 2016
1 parent 515e519 commit 0538b73
Showing 1 changed file with 36 additions and 3 deletions.
39 changes: 36 additions & 3 deletions Features/Context/Users.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,38 @@
namespace EzSystems\PlatformUIBundle\Features\Context;

use Behat\Gherkin\Node\TableNode;
use EzSystems\PlatformBehatBundle\Context\RepositoryContext;
use eZ\Publish\API\Repository\Repository;
use eZ\Publish\API\Repository\UserService;
use eZ\Publish\API\Repository\ContentService;

class Users extends PlatformUI
{
use RepositoryContext;

/**
* @var eZ\Publish\API\Repository\ContentService
*/
protected $userService;

/**
* @var eZ\Publish\API\Repository\ContentService
*/
protected $contentService;

/**
* @injectService $repository @ezpublish.api.repository
* @injectService $userService @ezpublish.api.service.user
* @injectService $contentService @ezpublish.api.service.content
*/
public function __construct(Repository $repository, UserService $userService, ContentService $contentService)
{
parent::__construct();
$this->setRepository($repository);
$this->userService = $userService;
$this->contentService = $contentService;
}

/**
* @When I create a new User
* @When I fill a new User fields with:
Expand Down Expand Up @@ -51,8 +80,12 @@ public function goToUserPage($username)
*/
public function editUserUser($username)
{
$this->clickOnTreePath("$username $username");
$this->sleep(); //safegaurd for application delays
$user = $this->userService->loadUserByLogin($username);
$userObject = $this->contentService->loadContent($user->getUserId());
$firstName = $userObject->getFieldValue('first_name');
$lastName = $userObject->getFieldValue('last_name');
$this->clickOnTreePath("$firstName $lastName");
$this->sleep(); //safeguard for application delays
$this->waitWhileLoading();
$this->clickActionBar('Edit');
}
Expand All @@ -62,7 +95,7 @@ public function editUserUser($username)
*/
public function iSeeUsersPage()
{
$this->sleep(); // safegaurd for application delays
$this->sleep(); // safeguard for application delays
$this->iSeeTitle('Users');
}

Expand Down

0 comments on commit 0538b73

Please sign in to comment.