-
Notifications
You must be signed in to change notification settings - Fork 3
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
Pass metadata with requests #32
Conversation
{ | ||
parent::__construct($agent); | ||
|
||
// Construct and stop the timer to use its timestamp logic. This event | ||
// is a single point in time, not a range. | ||
$this->timer = new Timer(); | ||
$this->timer->stop(); | ||
$this->timer = new Timer((float) $now->format('U.u')); |
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.
Is this explicit $now just for testing?
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.
Primarily yes; time is global state, so converting to use a defined time-stamp.in tests is always going to be a win. I've lost count of the number of tests I've discovered were flaky due to assumptions about date/time 😁
Adds metadata into the requests made.
Currently, it's difficult to test this, as we cannot inject dependencies, so have no way to "fake" the server. I'll look at refactoring and fixing this separately as it's not strictly related.