Skip to content

Commit

Permalink
Merge pull request #36773 from owncloud/move-setLastLoginDate
Browse files Browse the repository at this point in the history
[Tests-only] Move function "set last login date" from "testingAppContext" to "FeatureContext"
  • Loading branch information
phil-davis authored Jan 16, 2020
2 parents 0044776 + e55a7f1 commit 4bf22e5
Showing 1 changed file with 25 additions and 0 deletions.
25 changes: 25 additions & 0 deletions tests/acceptance/features/bootstrap/FeatureContext.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
*/

use rdx\behatvars\BehatVariablesContext;
use TestHelpers\OcsApiHelper;

require_once 'bootstrap.php';

Expand All @@ -41,4 +42,28 @@ protected function resetAppConfigs() {
// Set the required starting values for testing
$this->setCapabilities($this->getCommonSharingConfigs());
}

/**
* @Given the administrator has set the last login date for user :user to :days days ago
* @When the administrator sets the last login date for user :user to :days days ago using the testing API
*
* @param string $user
* @param string $days
*
* @return void
*/
public function theAdministratorSetsTheLastLoginDateForUserToDaysAgoUsingTheTestingApi($user, $days) {
$adminUser = $this->getAdminUsername();
$baseUrl = "/apps/testing/api/v1/lastlogindate/{$user}";
$response = OcsApiHelper::sendRequest(
$this->getBaseUrl(),
$adminUser,
$this->getAdminPassword(),
'POST',
$baseUrl,
['days' => $days],
$this->getOcsApiVersion()
);
$this->setResponse($response);
}
}

0 comments on commit 4bf22e5

Please sign in to comment.