mirror of
https://github.com/opencloud-eu/opencloud.git
synced 2025-12-30 17:00:57 -06:00
delete unnecessary steps from context files
This commit is contained in:
@@ -23,7 +23,6 @@ use Behat\Behat\Hook\Scope\BeforeScenarioScope;
|
||||
use Behat\Gherkin\Node\TableNode;
|
||||
use GuzzleHttp\Exception\GuzzleException;
|
||||
use TestHelpers\HttpRequestHelper;
|
||||
use TestHelpers\SetupHelper;
|
||||
use TestHelpers\BehatHelper;
|
||||
use PHPUnit\Framework\Assert;
|
||||
use Psr\Http\Message\ResponseInterface;
|
||||
|
||||
@@ -932,26 +932,6 @@ class FeatureContext extends BehatVariablesContext {
|
||||
$this->ocsApiVersion = (int)$version;
|
||||
}
|
||||
|
||||
/**
|
||||
* @Given /^as user "([^"]*)"$/
|
||||
*
|
||||
* @param string $user
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function asUser(string $user): void {
|
||||
$this->currentUser = $this->getActualUsername($user);
|
||||
}
|
||||
|
||||
/**
|
||||
* @Given as the administrator
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function asTheAdministrator(): void {
|
||||
$this->currentUser = $this->getAdminUsername();
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
@@ -1690,21 +1670,6 @@ class FeatureContext extends BehatVariablesContext {
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @Then the HTTP status code should be failure
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function theHTTPStatusCodeShouldBeFailure(): void {
|
||||
$statusCode = $this->response->getStatusCode();
|
||||
$message = "The HTTP status code $statusCode is not greater than or equals to 400";
|
||||
Assert::assertGreaterThanOrEqual(
|
||||
400,
|
||||
$statusCode,
|
||||
$message
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $path
|
||||
* @param string $filename
|
||||
|
||||
@@ -170,20 +170,6 @@ class FilesVersionsContext implements Context {
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @When user :user gets the version metadata of file :file
|
||||
*
|
||||
* @param string $user
|
||||
* @param string $file
|
||||
*
|
||||
* @return void
|
||||
* @throws Exception
|
||||
*/
|
||||
public function userGetsVersionMetadataOfFile(string $user, string $file): void {
|
||||
$response = $this->getFileVersionMetadata($user, $file);
|
||||
$this->featureContext->setResponse($response, $user);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $user
|
||||
* @param string $file
|
||||
@@ -335,24 +321,6 @@ class FilesVersionsContext implements Context {
|
||||
$this->assertFileVersionsCount($user, $fileId, $count);
|
||||
}
|
||||
|
||||
/**
|
||||
* @Then the version folder of fileId :fileId for user :user should contain :count element(s)
|
||||
*
|
||||
* @param string $fileId
|
||||
* @param string $user
|
||||
* @param int $count
|
||||
*
|
||||
* @return void
|
||||
* @throws Exception
|
||||
*/
|
||||
public function theVersionFolderOfFileIdShouldContainElements(
|
||||
string $fileId,
|
||||
string $user,
|
||||
int $count
|
||||
): void {
|
||||
$this->assertFileVersionsCount($user, $fileId, $count);
|
||||
}
|
||||
|
||||
/**
|
||||
* @Then the content length of file :path with version index :index for user :user in versions folder should be :length
|
||||
*
|
||||
|
||||
@@ -25,7 +25,6 @@ require_once 'bootstrap.php';
|
||||
class NotificationContext implements Context {
|
||||
private FeatureContext $featureContext;
|
||||
private SpacesContext $spacesContext;
|
||||
private SettingsContext $settingsContext;
|
||||
private string $notificationEndpointPath = '/apps/notifications/api/v1/notifications?format=json';
|
||||
private string $globalNotificationEndpointPath = '/apps/notifications/api/v1/notifications/global';
|
||||
|
||||
@@ -99,7 +98,6 @@ class NotificationContext implements Context {
|
||||
// Get all the contexts you need in this context
|
||||
$this->featureContext = BehatHelper::getContext($scope, $environment, 'FeatureContext');
|
||||
$this->spacesContext = BehatHelper::getContext($scope, $environment, 'SpacesContext');
|
||||
$this->settingsContext = BehatHelper::getContext($scope, $environment, 'SettingsContext');
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -37,40 +37,40 @@ require_once 'bootstrap.php';
|
||||
class OCSContext implements Context {
|
||||
private FeatureContext $featureContext;
|
||||
|
||||
/**
|
||||
* @When /^the user sends HTTP method "([^"]*)" to OCS API endpoint "([^"]*)"$/
|
||||
*
|
||||
* @param string $verb
|
||||
* @param string $url
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function theUserSendsToOcsApiEndpoint(string $verb, string $url): void {
|
||||
$response = $this->theUserSendsToOcsApiEndpointWithBody($verb, $url);
|
||||
$this->featureContext->setResponse($response);
|
||||
}
|
||||
// /**
|
||||
// * @When /^the user sends HTTP method "([^"]*)" to OCS API endpoint "([^"]*)"$/
|
||||
// *
|
||||
// * @param string $verb
|
||||
// * @param string $url
|
||||
// *
|
||||
// * @return void
|
||||
// */
|
||||
// public function theUserSendsToOcsApiEndpoint(string $verb, string $url): void {
|
||||
// $response = $this->theUserSendsToOcsApiEndpointWithBody($verb, $url);
|
||||
// $this->featureContext->setResponse($response);
|
||||
// }
|
||||
|
||||
/**
|
||||
* @When /^user "([^"]*)" sends HTTP method "([^"]*)" to OCS API endpoint "([^"]*)"$/
|
||||
* @When /^user "([^"]*)" sends HTTP method "([^"]*)" to OCS API endpoint "([^"]*)" using password "([^"]*)"$/
|
||||
*
|
||||
* @param string $user
|
||||
* @param string $verb
|
||||
* @param string $url
|
||||
* @param string|null $password
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function userSendsToOcsApiEndpoint(string $user, string $verb, string $url, ?string $password = null): void {
|
||||
$response = $this->sendRequestToOcsEndpoint(
|
||||
$user,
|
||||
$verb,
|
||||
$url,
|
||||
null,
|
||||
$password
|
||||
);
|
||||
$this->featureContext->setResponse($response);
|
||||
}
|
||||
// /**
|
||||
// * @When /^user "([^"]*)" sends HTTP method "([^"]*)" to OCS API endpoint "([^"]*)"$/
|
||||
// * @When /^user "([^"]*)" sends HTTP method "([^"]*)" to OCS API endpoint "([^"]*)" using password "([^"]*)"$/
|
||||
// *
|
||||
// * @param string $user
|
||||
// * @param string $verb
|
||||
// * @param string $url
|
||||
// * @param string|null $password
|
||||
// *
|
||||
// * @return void
|
||||
// */
|
||||
// public function userSendsToOcsApiEndpoint(string $user, string $verb, string $url, ?string $password = null): void {
|
||||
// $response = $this->sendRequestToOcsEndpoint(
|
||||
// $user,
|
||||
// $verb,
|
||||
// $url,
|
||||
// null,
|
||||
// $password
|
||||
// );
|
||||
// $this->featureContext->setResponse($response);
|
||||
// }
|
||||
|
||||
/**
|
||||
* @param string $user
|
||||
@@ -162,59 +162,59 @@ class OCSContext implements Context {
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @When /^user "([^"]*)" sends HTTP method "([^"]*)" to OCS API endpoint "([^"]*)" with body$/
|
||||
*
|
||||
* @param string $user
|
||||
* @param string $verb
|
||||
* @param string $url
|
||||
* @param TableNode|null $body
|
||||
* @param string|null $password
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function userSendHTTPMethodToOcsApiEndpointWithBody(
|
||||
string $user,
|
||||
string $verb,
|
||||
string $url,
|
||||
?TableNode $body = null,
|
||||
?string $password = null
|
||||
): void {
|
||||
$response = $this->sendRequestToOcsEndpoint(
|
||||
$user,
|
||||
$verb,
|
||||
$url,
|
||||
$body,
|
||||
$password
|
||||
);
|
||||
$this->featureContext->setResponse($response);
|
||||
}
|
||||
// /**
|
||||
// * @When /^user "([^"]*)" sends HTTP method "([^"]*)" to OCS API endpoint "([^"]*)" with body$/
|
||||
// *
|
||||
// * @param string $user
|
||||
// * @param string $verb
|
||||
// * @param string $url
|
||||
// * @param TableNode|null $body
|
||||
// * @param string|null $password
|
||||
// *
|
||||
// * @return void
|
||||
// */
|
||||
// public function userSendHTTPMethodToOcsApiEndpointWithBody(
|
||||
// string $user,
|
||||
// string $verb,
|
||||
// string $url,
|
||||
// ?TableNode $body = null,
|
||||
// ?string $password = null
|
||||
// ): void {
|
||||
// $response = $this->sendRequestToOcsEndpoint(
|
||||
// $user,
|
||||
// $verb,
|
||||
// $url,
|
||||
// $body,
|
||||
// $password
|
||||
// );
|
||||
// $this->featureContext->setResponse($response);
|
||||
// }
|
||||
|
||||
/**
|
||||
* @When the administrator sends HTTP method :verb to OCS API endpoint :url
|
||||
* @When the administrator sends HTTP method :verb to OCS API endpoint :url using password :password
|
||||
*
|
||||
* @param string $verb
|
||||
* @param string $url
|
||||
* @param string|null $password
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function theAdministratorSendsHttpMethodToOcsApiEndpoint(
|
||||
string $verb,
|
||||
string $url,
|
||||
?string $password = null
|
||||
): void {
|
||||
$this->featureContext->setResponse(
|
||||
$this->sendRequestToOcsEndpoint(
|
||||
$this->featureContext->getAdminUsername(),
|
||||
$verb,
|
||||
$url,
|
||||
null,
|
||||
$password
|
||||
)
|
||||
);
|
||||
}
|
||||
// /**
|
||||
// * @When the administrator sends HTTP method :verb to OCS API endpoint :url
|
||||
// * @When the administrator sends HTTP method :verb to OCS API endpoint :url using password :password
|
||||
// *
|
||||
// * @param string $verb
|
||||
// * @param string $url
|
||||
// * @param string|null $password
|
||||
// *
|
||||
// * @return void
|
||||
// */
|
||||
// public function theAdministratorSendsHttpMethodToOcsApiEndpoint(
|
||||
// string $verb,
|
||||
// string $url,
|
||||
// ?string $password = null
|
||||
// ): void {
|
||||
// $this->featureContext->setResponse(
|
||||
// $this->sendRequestToOcsEndpoint(
|
||||
// $this->featureContext->getAdminUsername(),
|
||||
// $verb,
|
||||
// $url,
|
||||
// null,
|
||||
// $password
|
||||
// )
|
||||
// );
|
||||
// }
|
||||
|
||||
/**
|
||||
* @When /^user "([^"]*)" sends HTTP method "([^"]*)" to OCS API endpoint "([^"]*)" with headers$/
|
||||
@@ -247,158 +247,158 @@ class OCSContext implements Context {
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @When /^the administrator sends HTTP method "([^"]*)" to OCS API endpoint "([^"]*)" with headers$/
|
||||
*
|
||||
* @param string $verb
|
||||
* @param string $url
|
||||
* @param TableNode $headersTable
|
||||
*
|
||||
* @return void
|
||||
* @throws Exception
|
||||
*/
|
||||
public function administratorSendsToOcsApiEndpointWithHeaders(
|
||||
string $verb,
|
||||
string $url,
|
||||
TableNode $headersTable
|
||||
): void {
|
||||
$user = $this->featureContext->getAdminUsername();
|
||||
$password = $this->featureContext->getPasswordForUser($user);
|
||||
$this->featureContext->setResponse(
|
||||
$this->sendRequestToOcsEndpoint(
|
||||
$user,
|
||||
$verb,
|
||||
$url,
|
||||
null,
|
||||
$password,
|
||||
$headersTable->getRowsHash()
|
||||
)
|
||||
);
|
||||
}
|
||||
// /**
|
||||
// * @When /^the administrator sends HTTP method "([^"]*)" to OCS API endpoint "([^"]*)" with headers$/
|
||||
// *
|
||||
// * @param string $verb
|
||||
// * @param string $url
|
||||
// * @param TableNode $headersTable
|
||||
// *
|
||||
// * @return void
|
||||
// * @throws Exception
|
||||
// */
|
||||
// public function administratorSendsToOcsApiEndpointWithHeaders(
|
||||
// string $verb,
|
||||
// string $url,
|
||||
// TableNode $headersTable
|
||||
// ): void {
|
||||
// $user = $this->featureContext->getAdminUsername();
|
||||
// $password = $this->featureContext->getPasswordForUser($user);
|
||||
// $this->featureContext->setResponse(
|
||||
// $this->sendRequestToOcsEndpoint(
|
||||
// $user,
|
||||
// $verb,
|
||||
// $url,
|
||||
// null,
|
||||
// $password,
|
||||
// $headersTable->getRowsHash()
|
||||
// )
|
||||
// );
|
||||
// }
|
||||
|
||||
/**
|
||||
* @When /^the administrator sends HTTP method "([^"]*)" to OCS API endpoint "([^"]*)" with headers using password "([^"]*)"$/
|
||||
*
|
||||
* @param string $verb
|
||||
* @param string $url
|
||||
* @param string $password
|
||||
* @param TableNode $headersTable
|
||||
*
|
||||
* @return void
|
||||
* @throws Exception
|
||||
*/
|
||||
public function administratorSendsToOcsApiEndpointWithHeadersAndPassword(
|
||||
string $verb,
|
||||
string $url,
|
||||
string $password,
|
||||
TableNode $headersTable
|
||||
): void {
|
||||
$this->featureContext->setResponse(
|
||||
$this->sendRequestToOcsEndpoint(
|
||||
$this->featureContext->getAdminUsername(),
|
||||
$verb,
|
||||
$url,
|
||||
null,
|
||||
$password,
|
||||
$headersTable->getRowsHash()
|
||||
)
|
||||
);
|
||||
}
|
||||
// /**
|
||||
// * @When /^the administrator sends HTTP method "([^"]*)" to OCS API endpoint "([^"]*)" with headers using password "([^"]*)"$/
|
||||
// *
|
||||
// * @param string $verb
|
||||
// * @param string $url
|
||||
// * @param string $password
|
||||
// * @param TableNode $headersTable
|
||||
// *
|
||||
// * @return void
|
||||
// * @throws Exception
|
||||
// */
|
||||
// public function administratorSendsToOcsApiEndpointWithHeadersAndPassword(
|
||||
// string $verb,
|
||||
// string $url,
|
||||
// string $password,
|
||||
// TableNode $headersTable
|
||||
// ): void {
|
||||
// $this->featureContext->setResponse(
|
||||
// $this->sendRequestToOcsEndpoint(
|
||||
// $this->featureContext->getAdminUsername(),
|
||||
// $verb,
|
||||
// $url,
|
||||
// null,
|
||||
// $password,
|
||||
// $headersTable->getRowsHash()
|
||||
// )
|
||||
// );
|
||||
// }
|
||||
|
||||
/**
|
||||
* @When the administrator sends HTTP method :verb to OCS API endpoint :url with body
|
||||
*
|
||||
* @param string $verb
|
||||
* @param string $url
|
||||
* @param TableNode|null $body
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function theAdministratorSendsHttpMethodToOcsApiEndpointWithBody(
|
||||
string $verb,
|
||||
string $url,
|
||||
?TableNode $body
|
||||
): void {
|
||||
$response = $this->adminSendsHttpMethodToOcsApiEndpointWithBody(
|
||||
$verb,
|
||||
$url,
|
||||
$body
|
||||
);
|
||||
$this->featureContext->setResponse($response);
|
||||
}
|
||||
// /**
|
||||
// * @When the administrator sends HTTP method :verb to OCS API endpoint :url with body
|
||||
// *
|
||||
// * @param string $verb
|
||||
// * @param string $url
|
||||
// * @param TableNode|null $body
|
||||
// *
|
||||
// * @return void
|
||||
// */
|
||||
// public function theAdministratorSendsHttpMethodToOcsApiEndpointWithBody(
|
||||
// string $verb,
|
||||
// string $url,
|
||||
// ?TableNode $body
|
||||
// ): void {
|
||||
// $response = $this->adminSendsHttpMethodToOcsApiEndpointWithBody(
|
||||
// $verb,
|
||||
// $url,
|
||||
// $body
|
||||
// );
|
||||
// $this->featureContext->setResponse($response);
|
||||
// }
|
||||
|
||||
/**
|
||||
* @When /^the user sends HTTP method "([^"]*)" to OCS API endpoint "([^"]*)" with body$/
|
||||
*
|
||||
* @param string $verb
|
||||
* @param string $url
|
||||
* @param TableNode $body
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function theUserSendsHTTPMethodToOcsApiEndpointWithBody(string $verb, string $url, TableNode $body): void {
|
||||
$response = $this->theUserSendsToOcsApiEndpointWithBody(
|
||||
$verb,
|
||||
$url,
|
||||
$body
|
||||
);
|
||||
$this->featureContext->setResponse($response);
|
||||
}
|
||||
// /**
|
||||
// * @When /^the user sends HTTP method "([^"]*)" to OCS API endpoint "([^"]*)" with body$/
|
||||
// *
|
||||
// * @param string $verb
|
||||
// * @param string $url
|
||||
// * @param TableNode $body
|
||||
// *
|
||||
// * @return void
|
||||
// */
|
||||
// public function theUserSendsHTTPMethodToOcsApiEndpointWithBody(string $verb, string $url, TableNode $body): void {
|
||||
// $response = $this->theUserSendsToOcsApiEndpointWithBody(
|
||||
// $verb,
|
||||
// $url,
|
||||
// $body
|
||||
// );
|
||||
// $this->featureContext->setResponse($response);
|
||||
// }
|
||||
|
||||
/**
|
||||
* @When the administrator sends HTTP method :verb to OCS API endpoint :url with body using password :password
|
||||
*
|
||||
* @param string $verb
|
||||
* @param string $url
|
||||
* @param string $password
|
||||
* @param TableNode $body
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function theAdministratorSendsHttpMethodToOcsApiWithBodyAndPassword(
|
||||
string $verb,
|
||||
string $url,
|
||||
string $password,
|
||||
TableNode $body
|
||||
): void {
|
||||
$admin = $this->featureContext->getAdminUsername();
|
||||
$response = $this->sendRequestToOcsEndpoint(
|
||||
$admin,
|
||||
$verb,
|
||||
$url,
|
||||
$body,
|
||||
$password
|
||||
);
|
||||
$this->featureContext->setResponse($response);
|
||||
}
|
||||
// /**
|
||||
// * @When the administrator sends HTTP method :verb to OCS API endpoint :url with body using password :password
|
||||
// *
|
||||
// * @param string $verb
|
||||
// * @param string $url
|
||||
// * @param string $password
|
||||
// * @param TableNode $body
|
||||
// *
|
||||
// * @return void
|
||||
// */
|
||||
// public function theAdministratorSendsHttpMethodToOcsApiWithBodyAndPassword(
|
||||
// string $verb,
|
||||
// string $url,
|
||||
// string $password,
|
||||
// TableNode $body
|
||||
// ): void {
|
||||
// $admin = $this->featureContext->getAdminUsername();
|
||||
// $response = $this->sendRequestToOcsEndpoint(
|
||||
// $admin,
|
||||
// $verb,
|
||||
// $url,
|
||||
// $body,
|
||||
// $password
|
||||
// );
|
||||
// $this->featureContext->setResponse($response);
|
||||
// }
|
||||
|
||||
/**
|
||||
* @When /^user "([^"]*)" sends HTTP method "([^"]*)" to OCS API endpoint "([^"]*)" with body using password "([^"]*)"$/
|
||||
*
|
||||
* @param string $user
|
||||
* @param string $verb
|
||||
* @param string $url
|
||||
* @param string $password
|
||||
* @param TableNode $body
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function userSendsHTTPMethodToOcsApiEndpointWithBodyAndPassword(
|
||||
string $user,
|
||||
string $verb,
|
||||
string $url,
|
||||
string $password,
|
||||
TableNode $body
|
||||
): void {
|
||||
$response = $this->sendRequestToOcsEndpoint(
|
||||
$user,
|
||||
$verb,
|
||||
$url,
|
||||
$body,
|
||||
$password
|
||||
);
|
||||
$this->featureContext->setResponse($response);
|
||||
}
|
||||
// /**
|
||||
// * @When /^user "([^"]*)" sends HTTP method "([^"]*)" to OCS API endpoint "([^"]*)" with body using password "([^"]*)"$/
|
||||
// *
|
||||
// * @param string $user
|
||||
// * @param string $verb
|
||||
// * @param string $url
|
||||
// * @param string $password
|
||||
// * @param TableNode $body
|
||||
// *
|
||||
// * @return void
|
||||
// */
|
||||
// public function userSendsHTTPMethodToOcsApiEndpointWithBodyAndPassword(
|
||||
// string $user,
|
||||
// string $verb,
|
||||
// string $url,
|
||||
// string $password,
|
||||
// TableNode $body
|
||||
// ): void {
|
||||
// $response = $this->sendRequestToOcsEndpoint(
|
||||
// $user,
|
||||
// $verb,
|
||||
// $url,
|
||||
// $body,
|
||||
// $password
|
||||
// );
|
||||
// $this->featureContext->setResponse($response);
|
||||
// }
|
||||
|
||||
/**
|
||||
* @Then /^the OCS status code should be "([^"]*)"$/
|
||||
@@ -494,64 +494,64 @@ class OCSContext implements Context {
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Check the text in an OCS status message
|
||||
*
|
||||
* @Then /^the OCS status message about user "([^"]*)" should be "([^"]*)"$/
|
||||
*
|
||||
* @param string $user
|
||||
* @param string $statusMessage
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function theOCSStatusMessageAboutUserShouldBe(string $user, string $statusMessage): void {
|
||||
$user = \strtolower($this->featureContext->getActualUsername($user));
|
||||
$statusMessage = $this->featureContext->substituteInLineCodes(
|
||||
$statusMessage,
|
||||
$user
|
||||
);
|
||||
Assert::assertEquals(
|
||||
$statusMessage,
|
||||
$this->getOCSResponseStatusMessage(
|
||||
$this->featureContext->getResponse()
|
||||
),
|
||||
'Unexpected OCS status message :"' . $this->getOCSResponseStatusMessage(
|
||||
$this->featureContext->getResponse()
|
||||
) . '" in response'
|
||||
);
|
||||
}
|
||||
// /**
|
||||
// * Check the text in an OCS status message
|
||||
// *
|
||||
// * @Then /^the OCS status message about user "([^"]*)" should be "([^"]*)"$/
|
||||
// *
|
||||
// * @param string $user
|
||||
// * @param string $statusMessage
|
||||
// *
|
||||
// * @return void
|
||||
// */
|
||||
// public function theOCSStatusMessageAboutUserShouldBe(string $user, string $statusMessage): void {
|
||||
// $user = \strtolower($this->featureContext->getActualUsername($user));
|
||||
// $statusMessage = $this->featureContext->substituteInLineCodes(
|
||||
// $statusMessage,
|
||||
// $user
|
||||
// );
|
||||
// Assert::assertEquals(
|
||||
// $statusMessage,
|
||||
// $this->getOCSResponseStatusMessage(
|
||||
// $this->featureContext->getResponse()
|
||||
// ),
|
||||
// 'Unexpected OCS status message :"' . $this->getOCSResponseStatusMessage(
|
||||
// $this->featureContext->getResponse()
|
||||
// ) . '" in response'
|
||||
// );
|
||||
// }
|
||||
|
||||
/**
|
||||
* Check the text in an OCS status message.
|
||||
* Use this step form if the expected text contains double quotes,
|
||||
* single quotes and other content that theOCSStatusMessageShouldBe()
|
||||
* cannot handle.
|
||||
*
|
||||
* After the step, write the expected text in PyString form like:
|
||||
*
|
||||
* """
|
||||
* File "abc.txt" can't be shared due to reason "xyz"
|
||||
* """
|
||||
*
|
||||
* @Then /^the OCS status message should be:$/
|
||||
*
|
||||
* @param PyStringNode $statusMessage
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function theOCSStatusMessageShouldBePyString(
|
||||
PyStringNode $statusMessage
|
||||
): void {
|
||||
Assert::assertEquals(
|
||||
$statusMessage->getRaw(),
|
||||
$this->getOCSResponseStatusMessage(
|
||||
$this->featureContext->getResponse()
|
||||
),
|
||||
'Unexpected OCS status message: "' . $this->getOCSResponseStatusMessage(
|
||||
$this->featureContext->getResponse()
|
||||
) . '" in response'
|
||||
);
|
||||
}
|
||||
// /**
|
||||
// * Check the text in an OCS status message.
|
||||
// * Use this step form if the expected text contains double quotes,
|
||||
// * single quotes and other content that theOCSStatusMessageShouldBe()
|
||||
// * cannot handle.
|
||||
// *
|
||||
// * After the step, write the expected text in PyString form like:
|
||||
// *
|
||||
// * """
|
||||
// * File "abc.txt" can't be shared due to reason "xyz"
|
||||
// * """
|
||||
// *
|
||||
// * @Then /^the OCS status message should be:$/
|
||||
// *
|
||||
// * @param PyStringNode $statusMessage
|
||||
// *
|
||||
// * @return void
|
||||
// */
|
||||
// public function theOCSStatusMessageShouldBePyString(
|
||||
// PyStringNode $statusMessage
|
||||
// ): void {
|
||||
// Assert::assertEquals(
|
||||
// $statusMessage->getRaw(),
|
||||
// $this->getOCSResponseStatusMessage(
|
||||
// $this->featureContext->getResponse()
|
||||
// ),
|
||||
// 'Unexpected OCS status message: "' . $this->getOCSResponseStatusMessage(
|
||||
// $this->featureContext->getResponse()
|
||||
// ) . '" in response'
|
||||
// );
|
||||
// }
|
||||
|
||||
/**
|
||||
* Parses the xml answer to get ocs response which doesn't match with
|
||||
|
||||
@@ -132,10 +132,7 @@ class PublicWebDavContext implements Context {
|
||||
);
|
||||
$password = $this->featureContext->getActualPassword($password);
|
||||
$fullUrl = $this->featureContext->getBaseUrl() . "/$davPath/$fileName";
|
||||
$userName = $this->getUsernameForPublicWebdavApi(
|
||||
$token,
|
||||
$password
|
||||
);
|
||||
$userName = $this->getUsernameForPublicWebdavApi($password);
|
||||
$headers = [
|
||||
'X-Requested-With' => 'XMLHttpRequest'
|
||||
];
|
||||
@@ -205,10 +202,7 @@ class PublicWebDavContext implements Context {
|
||||
$fullUrl = $this->featureContext->getBaseUrl() . "/$davPath/$fileName";
|
||||
$password = $this->featureContext->getActualPassword($password);
|
||||
$destination = $this->featureContext->getBaseUrl() . "/$davPath/$toFileName";
|
||||
$userName = $this->getUsernameForPublicWebdavApi(
|
||||
$token,
|
||||
$password
|
||||
);
|
||||
$userName = $this->getUsernameForPublicWebdavApi($password);
|
||||
$headers = [
|
||||
'X-Requested-With' => 'XMLHttpRequest',
|
||||
'Destination' => $destination
|
||||
@@ -321,10 +315,7 @@ class PublicWebDavContext implements Context {
|
||||
"public-files"
|
||||
);
|
||||
$fullUrl = $this->featureContext->getBaseUrl() . "/$davPath/$path";
|
||||
$userName = $this->getUsernameForPublicWebdavApi(
|
||||
$token,
|
||||
$password
|
||||
);
|
||||
$userName = $this->getUsernameForPublicWebdavApi($password);
|
||||
|
||||
$headers = [
|
||||
'X-Requested-With' => 'XMLHttpRequest'
|
||||
@@ -410,48 +401,6 @@ class PublicWebDavContext implements Context {
|
||||
$this->featureContext->setResponse($response);
|
||||
}
|
||||
|
||||
/**
|
||||
* This only works with the old API, auto-rename is not supported in the new API
|
||||
* auto renaming is handled on files drop folders implicitly
|
||||
*
|
||||
* @param string $filename target file name
|
||||
* @param string $body content to upload
|
||||
*
|
||||
* @return ResponseInterface
|
||||
*/
|
||||
public function publiclyUploadingContentAutoRename(string $filename, string $body = 'test'): ResponseInterface {
|
||||
return $this->publicUploadContent($filename, '', $body, true);
|
||||
}
|
||||
|
||||
/**
|
||||
* @When the public uploads file :filename with content :body with auto-rename mode using the old public WebDAV API
|
||||
*
|
||||
* @param string $filename target file name
|
||||
* @param string $body content to upload
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function thePublicUploadsFileWithContentWithAutoRenameMode(string $filename, string $body = 'test'): void {
|
||||
$response = $this->publiclyUploadingContentAutoRename($filename, $body);
|
||||
$this->featureContext->setResponse($response);
|
||||
}
|
||||
|
||||
/**
|
||||
* @Given the public has uploaded file :filename with content :body with auto-rename mode
|
||||
*
|
||||
* @param string $filename target file name
|
||||
* @param string $body content to upload
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function thePublicHasUploadedFileWithContentWithAutoRenameMode(
|
||||
string $filename,
|
||||
string $body = 'test'
|
||||
): void {
|
||||
$response = $this->publiclyUploadingContentAutoRename($filename, $body);
|
||||
$this->featureContext->theHTTPStatusCodeShouldBe([201, 204], "", $response);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $filename target file name
|
||||
* @param string $password
|
||||
@@ -997,10 +946,7 @@ class PublicWebDavContext implements Context {
|
||||
);
|
||||
$url = $this->featureContext->getBaseUrl() . "/$davPath/";
|
||||
$password = $this->featureContext->getActualPassword($password);
|
||||
$userName = $this->getUsernameForPublicWebdavApi(
|
||||
$token,
|
||||
$password
|
||||
);
|
||||
$userName = $this->getUsernameForPublicWebdavApi($password);
|
||||
$foldername = \implode(
|
||||
'/',
|
||||
\array_map('rawurlencode', \explode('/', $destination))
|
||||
@@ -1152,10 +1098,7 @@ class PublicWebDavContext implements Context {
|
||||
$token,
|
||||
"public-files"
|
||||
);
|
||||
$userName = $this->getUsernameForPublicWebdavApi(
|
||||
$token,
|
||||
$password
|
||||
);
|
||||
$userName = $this->getUsernameForPublicWebdavApi($password);
|
||||
|
||||
$filename = \implode(
|
||||
'/',
|
||||
@@ -1184,13 +1127,11 @@ class PublicWebDavContext implements Context {
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $token
|
||||
* @param string $password
|
||||
*
|
||||
* @return string|null
|
||||
*/
|
||||
private function getUsernameForPublicWebdavApi(
|
||||
string $token,
|
||||
string $password
|
||||
): ?string {
|
||||
if ($password !== '') {
|
||||
@@ -1249,10 +1190,7 @@ class PublicWebDavContext implements Context {
|
||||
"public-files"
|
||||
);
|
||||
$password = $this->featureContext->getActualPassword($password);
|
||||
$username = $this->getUsernameForPublicWebdavApi(
|
||||
$token,
|
||||
$password
|
||||
);
|
||||
$username = $this->getUsernameForPublicWebdavApi($password);
|
||||
$fullUrl = $this->featureContext->getBaseUrl() . "/$davPath";
|
||||
$response = HttpRequestHelper::sendRequest(
|
||||
$fullUrl,
|
||||
|
||||
@@ -24,7 +24,6 @@ require_once 'bootstrap.php';
|
||||
*/
|
||||
class SettingsContext implements Context {
|
||||
private FeatureContext $featureContext;
|
||||
private string $settingsUrl = '/api/v0/settings/';
|
||||
|
||||
/**
|
||||
* This will run before EVERY scenario.
|
||||
|
||||
@@ -37,21 +37,6 @@ class ShareesContext implements Context {
|
||||
private FeatureContext $featureContext;
|
||||
private OCSContext $ocsContext;
|
||||
|
||||
/**
|
||||
* @When /^the user gets the sharees using the sharing API with parameters$/
|
||||
*
|
||||
* @param TableNode $body
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function theUserGetsTheShareesWithParameters(TableNode $body): void {
|
||||
$this->featureContext->setResponse(
|
||||
$this->getShareesWithParameters(
|
||||
$this->featureContext->getCurrentUser(),
|
||||
$body
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @When /^user "([^"]*)" gets the sharees using the sharing API with parameters$/
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -26,7 +26,6 @@ use GuzzleHttp\Exception\GuzzleException;
|
||||
use PHPUnit\Framework\Assert;
|
||||
use Psr\Http\Message\ResponseInterface;
|
||||
use TestHelpers\GraphHelper;
|
||||
use TestHelpers\OcHelper;
|
||||
use TestHelpers\WebDavHelper;
|
||||
use TestHelpers\HttpRequestHelper;
|
||||
use TestHelpers\BehatHelper;
|
||||
|
||||
@@ -29,7 +29,6 @@ use PHPUnit\Framework\Assert;
|
||||
use Psr\Http\Message\ResponseInterface;
|
||||
use TestHelpers\HttpRequestHelper;
|
||||
use TestHelpers\WebDavHelper;
|
||||
use TestHelpers\SetupHelper;
|
||||
use TestHelpers\GraphHelper;
|
||||
use TestHelpers\OcHelper;
|
||||
use TestHelpers\BehatHelper;
|
||||
|
||||
@@ -14,8 +14,6 @@ use GuzzleHttp\Exception\GuzzleException;
|
||||
use PHPUnit\Framework\Assert;
|
||||
use TestHelpers\WebDavHelper;
|
||||
use TestHelpers\BehatHelper;
|
||||
use TestHelpers\GraphHelper;
|
||||
use TestHelpers\HttpRequestHelper;
|
||||
|
||||
require_once 'bootstrap.php';
|
||||
|
||||
|
||||
@@ -70,17 +70,6 @@ class TrashbinContext implements Context {
|
||||
public function userEmptiesTrashbin(string $user): void {
|
||||
$this->featureContext->setResponse($this->emptyTrashbin($user));
|
||||
}
|
||||
/**
|
||||
* @Given user :user has emptied the trashbin
|
||||
*
|
||||
* @param string $user user
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function userHasEmptiedTrashbin(string $user): void {
|
||||
$response = $this->emptyTrashbin($user);
|
||||
$this->featureContext->theHTTPStatusCodeShouldBe(204, '', $response);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get files list from the response from trashbin api
|
||||
@@ -473,29 +462,6 @@ class TrashbinContext implements Context {
|
||||
$this->featureContext->setResponse($response);
|
||||
}
|
||||
|
||||
/**
|
||||
* @Then the last webdav response should contain the following elements
|
||||
*
|
||||
* @param TableNode $elements
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function theLastWebdavResponseShouldContainFollowingElements(TableNode $elements): void {
|
||||
$files = $this->getTrashbinContentFromResponseXml(HttpRequestHelper::getResponseXml($response, __METHOD__));
|
||||
$elementRows = $elements->getHash();
|
||||
foreach ($elementRows as $expectedElement) {
|
||||
$found = false;
|
||||
$expectedPath = $expectedElement['path'];
|
||||
foreach ($files as $file) {
|
||||
if (\ltrim($expectedPath, "/") === \ltrim($file['original-location'], "/")) {
|
||||
$found = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
Assert::assertTrue($found, "$expectedPath expected to be listed in response but not found");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @Then the last webdav response should not contain the following elements
|
||||
*
|
||||
@@ -950,37 +916,6 @@ class TrashbinContext implements Context {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @Then /^the content of file "([^"]*)" for user "([^"]*)" if the file is also in the trashbin should be "([^"]*)" otherwise "([^"]*)"$/
|
||||
*
|
||||
* Note: this is a special step for an unusual bug combination.
|
||||
* Delete it when the bug is fixed and the step is no longer needed.
|
||||
*
|
||||
* @param string|null $fileName
|
||||
* @param string|null $user
|
||||
* @param string|null $content
|
||||
* @param string|null $alternativeContent
|
||||
*
|
||||
* @return void
|
||||
* @throws JsonException
|
||||
* @throws Exception
|
||||
*/
|
||||
public function contentOfFileForUserIfAlsoInTrashShouldBeOtherwise(
|
||||
?string $fileName,
|
||||
?string $user,
|
||||
?string $content,
|
||||
?string $alternativeContent
|
||||
): void {
|
||||
$isInTrash = $this->isInTrash($user, $fileName);
|
||||
$user = $this->featureContext->getActualUsername($user);
|
||||
$response = $this->featureContext->downloadFileAsUserUsingPassword($user, $fileName);
|
||||
if ($isInTrash) {
|
||||
$this->featureContext->checkDownloadedContentMatches($content, '', $response);
|
||||
} else {
|
||||
$this->featureContext->checkDownloadedContentMatches($alternativeContent, '', $response);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @When /^user "([^"]*)" restores the (?:file|folder|entry) with original path "([^"]*)" using the trashbin API$/
|
||||
*
|
||||
|
||||
@@ -21,7 +21,6 @@
|
||||
|
||||
use Behat\Gherkin\Node\PyStringNode;
|
||||
use Behat\Gherkin\Node\TableNode;
|
||||
use GuzzleHttp\Exception\BadResponseException;
|
||||
use GuzzleHttp\Exception\GuzzleException;
|
||||
use PHPUnit\Framework\Assert;
|
||||
use Psr\Http\Message\ResponseInterface;
|
||||
|
||||
Reference in New Issue
Block a user