Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

[RateLimiter] Fix delete method of the cache storage#38661

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
Nyholm merged 3 commits intosymfony:5.xfromGregOriol:5.x
Oct 22, 2020

Conversation

@GregOriol
Copy link
Contributor

QA
Branch?5.2
Bug fix?yes
New feature?no
Deprecations?no
TicketsNone
LicenseMIT

This PR fixes a small issue with RateLimiter's cache storage and the delete method: all getItems are called with a sha1 of the id, but not the one for delete, which makes it miss the deletion.

Copy link
Member

@NyholmNyholm left a comment

Choose a reason for hiding this comment

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

Thank you. This is correct.

Could you add a small unit test for this too?

wouterj reacted with thumbs up emoji
@GregOriol
Copy link
ContributorAuthor

I'm not sure how to write such a test, I'd rather not try to make something up here.

@Nyholm
Copy link
Member

Do you mind if I push to your branch?

GregOriol reacted with thumbs up emoji

@GregOriol
Copy link
ContributorAuthor

Not at all, I'd be happy to take your suggestion on this :-)

Copy link
Member

@NyholmNyholm left a comment

Choose a reason for hiding this comment

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

I added a test.

Im happy with this PR.


publicfunctiontestDelete()
{
$this->pool->expects($this->once())->method('deleteItem')->with(sha1('test'))->willReturn(true);
Copy link
Member

@NyholmNyholmOct 22, 2020
edited
Loading

Choose a reason for hiding this comment

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

This line uses$this->pool which is a mock created insetUp().

We say that we "expect" that "once" the "methoddeleteItem" is called withsha1('test'). We also return true.

If what we expect does not happen, then the test will fail

GregOriol reacted with thumbs up emoji
{
$this->pool->expects($this->once())->method('deleteItem')->with(sha1('test'))->willReturn(true);

$this->storage->delete('test');
Copy link
Member

Choose a reason for hiding this comment

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

This is just calling the storage

GregOriol reacted with thumbs up emoji
@Nyholm
Copy link
Member

Thank you@GregOriol.

@NyholmNyholm merged commit76c22fa intosymfony:5.xOct 22, 2020
@fabpotfabpot mentioned this pull requestOct 28, 2020
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment

Reviewers

@jderussejderussejderusse approved these changes

@NyholmNyholmNyholm approved these changes

@wouterjwouterjAwaiting requested review from wouterj

Assignees

No one assigned

Projects

None yet

Milestone

5.2

Development

Successfully merging this pull request may close these issues.

6 participants

@GregOriol@Nyholm@jderusse@derrabus@chalasr@carsonbot

[8]ページ先頭

©2009-2025 Movatter.jp