mirror of
https://github.com/opencloud-eu/opencloud.git
synced 2026-04-14 04:17:36 -04:00
[tests-only] fix not optional parameter after optional (#5981)
This commit is contained in:
@@ -3700,15 +3700,15 @@ class FeatureContext extends BehatVariablesContext {
|
||||
/**
|
||||
* Verify that the tableNode contains expected headers
|
||||
*
|
||||
* @param TableNode $table
|
||||
* @param TableNode|null $table
|
||||
* @param array|null $requiredHeader
|
||||
* @param array|null $allowedHeader
|
||||
*
|
||||
* @return void
|
||||
* @throws Exception
|
||||
*/
|
||||
public function verifyTableNodeColumns(TableNode $table, ?array $requiredHeader = [], ?array $allowedHeader = []): void {
|
||||
if (\count($table->getHash()) < 1) {
|
||||
public function verifyTableNodeColumns(?TableNode $table, ?array $requiredHeader = [], ?array $allowedHeader = []): void {
|
||||
if ($table === null || \count($table->getHash()) < 1) {
|
||||
throw new Exception("Table should have at least one row.");
|
||||
}
|
||||
$tableHeaders = $table->getRows()[0];
|
||||
|
||||
@@ -921,7 +921,7 @@ class SpacesContext implements Context {
|
||||
* @param string|null $userName
|
||||
* @param string|null $fileName
|
||||
* @param string|null $groupName
|
||||
* @param TableNode $table
|
||||
* @param TableNode|null $table
|
||||
*
|
||||
* @return void
|
||||
* @throws Exception
|
||||
@@ -931,7 +931,7 @@ class SpacesContext implements Context {
|
||||
?string $userName = null,
|
||||
?string $fileName = null,
|
||||
?string $groupName = null,
|
||||
TableNode $table
|
||||
?TableNode $table = null
|
||||
): void {
|
||||
$this->featureContext->verifyTableNodeColumns($table, ['key', 'value']);
|
||||
Assert::assertIsArray($spaceAsArray = $this->getSpaceByNameFromResponse($spaceName), "No space with name $spaceName found");
|
||||
@@ -991,17 +991,17 @@ class SpacesContext implements Context {
|
||||
* @param string $spaceName
|
||||
* @param string|null $grantedUser
|
||||
* @param string|null $fileName
|
||||
* @param TableNode $table
|
||||
* @param TableNode|null $table
|
||||
*
|
||||
* @return void
|
||||
* @throws Exception|GuzzleException
|
||||
* @throws GuzzleException
|
||||
*/
|
||||
public function userHasSpaceWith(
|
||||
string $user,
|
||||
string $spaceName,
|
||||
?string $grantedUser = null,
|
||||
?string $fileName = null,
|
||||
TableNode $table
|
||||
?TableNode $table = null
|
||||
): void {
|
||||
$this->theUserListsAllHisAvailableSpacesUsingTheGraphApi($user);
|
||||
$this->featureContext->theHTTPStatusCodeShouldBe(
|
||||
@@ -1042,17 +1042,17 @@ class SpacesContext implements Context {
|
||||
* @param string $spaceName
|
||||
* @param string|null $userName
|
||||
* @param string|null $fileName
|
||||
* @param PyStringNode $schemaString
|
||||
* @param PyStringNode|null $schemaString
|
||||
*
|
||||
* @return void
|
||||
* @throws Exception
|
||||
*/
|
||||
public function theJsonDataFromLastResponseShouldMatch(
|
||||
string $spaceName,
|
||||
?string $userName = null,
|
||||
?string $fileName = null,
|
||||
PyStringNode $schemaString
|
||||
?PyStringNode $schemaString = null
|
||||
): void {
|
||||
Assert::assertNotNull($schemaString, 'schema is not valid JSON');
|
||||
if (isset($this->featureContext->getJsonDecodedResponseBodyContent()->value)) {
|
||||
$responseBody = $this->featureContext->getJsonDecodedResponseBodyContent()->value;
|
||||
foreach ($responseBody as $value) {
|
||||
@@ -1066,7 +1066,9 @@ class SpacesContext implements Context {
|
||||
}
|
||||
|
||||
// substitute the value here
|
||||
$schemaString = $schemaString->getRaw();
|
||||
if (\gettype($schemaString) !== 'string') {
|
||||
$schemaString = $schemaString->getRaw();
|
||||
}
|
||||
$schemaString = $this->featureContext->substituteInLineCodes(
|
||||
$schemaString,
|
||||
$this->featureContext->getCurrentUser(),
|
||||
@@ -1104,22 +1106,22 @@ class SpacesContext implements Context {
|
||||
* @Then /^for user "([^"]*)" the JSON response of space project should match$/
|
||||
* @Then /^for user "([^"]*)" the JSON response should contain space called "([^"]*)" and match$/
|
||||
* @Then /^for user "([^"]*)" the JSON response should contain space called "([^"]*)" (?:owned by|granted to) "([^"]*)" (?:with description file|with space image) "([^"]*)" and match$/
|
||||
|
||||
*
|
||||
* @param string $user
|
||||
* @param string $spaceName
|
||||
* @param string|null $spaceName
|
||||
* @param string|null $grantedUser
|
||||
* @param string|null $fileName
|
||||
* @param PyStringNode $schemaString
|
||||
* @param PyStringNode|null $schemaString
|
||||
*
|
||||
* @return void
|
||||
* @throws Exception|GuzzleException
|
||||
* @throws GuzzleException
|
||||
*/
|
||||
public function forUserTheJSONDataOfTheResponseShouldMatch(
|
||||
string $user,
|
||||
?string $spaceName = null,
|
||||
?string $grantedUser = null,
|
||||
?string $fileName = null,
|
||||
PyStringNode $schemaString
|
||||
?PyStringNode $schemaString = null
|
||||
): void {
|
||||
$this->theUserListsAllHisAvailableSpacesUsingTheGraphApi($user);
|
||||
$this->theJsonDataFromLastResponseShouldMatch($spaceName, $grantedUser, $fileName, $schemaString);
|
||||
|
||||
Reference in New Issue
Block a user