-
Notifications
You must be signed in to change notification settings - Fork 9.4k
[Backport 2.1-develop] Fix AcountManagementTest unit test fail randomly #11606
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
[Backport 2.1-develop] Fix AcountManagementTest unit test fail randomly #11606
Conversation
474e4d0
to
be6a7b1
Compare
$currentTimestamp = (new \DateTime())->getTimestamp(); | ||
$tokenTimestamp = (new \DateTime($rpTokenCreatedAt))->getTimestamp(); | ||
$currentTimestamp = ($this->dateTimeFactory->create())->getTimestamp(); | ||
$tokenTimestamp = ($this->dateTimeFactory->create($rpTokenCreatedAt))->getTimestamp(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Too fast :) 2.1 still supports PHP5.6:
PHP Parse error: syntax error, unexpected '->' (T_OBJECT_OPERATOR) in /home/travis/build/magento/magento2/app/code/Magento/Customer/Model/AccountManagement.php on line 1168
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ouch, I forgot remove wrapping parenthesis in this one, I've reviewed also 2.2 and 2.3 PRs and they are ok. Updated.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've been also playing with PhpStorm to configure code reformatting, static tests are still complaining about that, I'm fixing it.
be6a7b1
to
3953b0d
Compare
3953b0d
to
db010ca
Compare
…est fail randomly #11606
Surprisingly, after testing succesfully locally unit tests, I've found this error in Travis, in unit tests performed by \Magento\Customer\Test\Unit\Model\AccountManagementTest class:

Simply rebuilding the job worked and all the tests passed, but this error may happen again at any time, due to how are mocks built in that class:
Removing expected date fix this rare, weird, but actually happening, issue.
Manual testing scenarios
$dateTime = date(\Magento\Framework\Stdlib\DateTime::DATETIME_PHP_FORMAT);
to
$dateTime = '2017-10-20 00:00:00';
in \Magento\Customer\Test\Unit\Model\AccountManagementTest::prepareInitiatePasswordReset method.
Contribution checklist