Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Test: the fields of the last response should not include does not work with 'expiration' field #36545

Closed
skshetry opened this issue Dec 9, 2019 · 3 comments · Fixed by #36573

Comments

@skshetry
Copy link
Member

skshetry commented Dec 9, 2019

The following step does not work if we try to check for ANY_VALUE:

Then the fields of the last response should not include
  | expiration | ANY_VALUE |

Analysis:

This is due to how strtotime() works. This needs to be handled somewhere here:

if ((string) $field === 'expiration' && !empty($contentExpected)) {
$contentExpected
= \date(
'Y-m-d',
\strtotime(
$contentExpected,
$this->getServerShareTimeFromLastResponse()
)
) . " 00:00:00";
}

strtotime is passed ANY_VALUE which when fails returns FALSE. That, when passed to date()
returns the Unix epoch (i.e. 1st January 1970), and the content to assert is no longer ANY_VALUE.

This when passed to doesFieldValueMatchExpectedContent() then returns false even though the field is still there.

public function doesFieldValueMatchExpectedContent(
$field, $value, $contentExpected, $expectSuccess = true
) {
if (($contentExpected === "ANY_VALUE")
|| (($contentExpected === "A_TOKEN") && (\strlen($value) === 15))
|| (($contentExpected === "A_NUMBER") && \is_numeric($value))
|| (($contentExpected === "AN_URL") && $this->isAPublicLinkUrl($value))
|| (($field === 'remote') && (\rtrim($value, "/") === $contentExpected))
|| ($contentExpected === $value)
) {
if (!$expectSuccess) {
echo $field . " is unexpectedly set with value '" . $value . "'\n";
}
return true;
}
return false;
}

@phil-davis
Copy link
Contributor

@skshetry do you need this for your current user-group-expiration date work?
Are you going to repair it right away, or is it difficult?

@phil-davis
Copy link
Contributor

@skshetry done?

@skshetry
Copy link
Member Author

@phil-davis, it's not in master, yet. I'll close as soon as it gets into master.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants