Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ Given as user :user
Given user :user exists
Given sending :verb to :url
Given the response should be a JSON array with the following mandatory values
Given guest :guest exists
Given /^set the display name of user "([^"]*)" to "([^"]*)"$/
Given /^set the email of user "([^"]*)" to "([^"]*)"$/
Given sending :verb to ocs :url
Expand Down
13 changes: 13 additions & 0 deletions src/NextcloudApiContext.php
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,19 @@
}
}

#[Given('guest :guest exists')]
public function assureGuestExists(string $guest): void {
$response = $this->userExists($guest);
if ($response->getStatusCode() !== 200) {
static::createAnEnvironmentWithValueToBeUsedByOccCommand('OC_PASS', '123456');
$this->runCommandWithResultCode('guests:add admin ' . $guest . ' --password-from-env', 0);
// Set a display name different than the user ID to be able to
// ensure in the tests that the right value was returned.
$this->setUserDisplayName($guest);
self::$createdUsers[] = $guest;
}
}

protected function userExists(string $user): ResponseInterface {
$currentUser = $this->currentUser;
$this->setCurrentUser('admin');
Expand Down Expand Up @@ -175,7 +188,7 @@
}
$fullUrl = $this->baseUrl . $url;
$client = new Client();
if (!is_null($this->currentUser)) {

Check failure on line 191 in src/NextcloudApiContext.php

View workflow job for this annotation

GitHub Actions / Psalm check (8.3)

RedundantCondition

src/NextcloudApiContext.php:191:8: RedundantCondition: Type string for $this->currentUser is never null (see https://psalm.dev/122)

Check failure on line 191 in src/NextcloudApiContext.php

View workflow job for this annotation

GitHub Actions / Psalm check (8.2)

RedundantCondition

src/NextcloudApiContext.php:191:8: RedundantCondition: Type string for $this->currentUser is never null (see https://psalm.dev/122)

Check failure on line 191 in src/NextcloudApiContext.php

View workflow job for this annotation

GitHub Actions / Psalm check (8.1)

RedundantCondition

src/NextcloudApiContext.php:191:8: RedundantCondition: Type string for $this->currentUser is never null (see https://psalm.dev/122)
$options = array_merge(
['cookies' => $this->getUserCookieJar($this->currentUser)],
$options
Expand Down
Loading