Thanks to visit codestin.com
Credit goes to github.com

Skip to content

[Stopwatch] Fix volatile tests #14597

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

Closed
wants to merge 1 commit into from
Closed

[Stopwatch] Fix volatile tests #14597

wants to merge 1 commit into from

Conversation

dosten
Copy link
Contributor

@dosten dosten commented May 10, 2015

Q A
Bug fix? no
New feature? no
BC breaks? no
Deprecations? no
Tests pass? yes
Fixed tickets #14444
License MIT

This PR fixes some volatile tests, instead of asserting for a specific duration, check if after some time the duration is the same.

$this->assertInstanceof('Symfony\Component\Stopwatch\StopwatchEvent', $event);
$this->assertEquals(200, $event->getDuration(), null, self::DELTA);
$this->assertEquals($duration, $event->getDuration());
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If I always return 0 or null in getDuration (removing the return statement for instance), this test will pass. This means that it is not testing the method anymore

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry, i don't understand, removing the return statement into the component?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@stof he is just saying that you are not testing the method anymore with your changes. And indeed, it looks wrong to me. You just call getDuration() twice, and the second time, you check it returns the same as the first call. That does not test if the returned value is actually correct.

@fabpot
Copy link
Member

fabpot commented May 16, 2015

Closing as the fix is wrong

@fabpot fabpot closed this May 16, 2015
@dosten dosten deleted the fix-volatile-tests branch May 16, 2015 14:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants