-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
[HttpFoundation][Tests] Add expression request matcher tests #10322
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
Conversation
inelgnu
commented
Feb 24, 2014
Q | A |
---|---|
Bug fix? | no |
New feature? | no |
BC breaks? | no |
Deprecations? | no |
Tests pass? | yes |
Fixed tickets | n/a |
License | MIT |
Doc PR | n/a |
|
||
$expressionRequestMatcher->setExpression(new ExpressionLanguage(), 'request.getMethod() != method && request.getPathInfo() == path && request.getHost() == host && request.getClientIp() == ip && request.attributes.all() == attributes'); | ||
$this->assertFalse($expressionRequestMatcher->matches($request)); | ||
|
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.
remove this line break
@cordoval i have add data providers. |
$expressionRequestMatcher->matches(new Request()); | ||
} | ||
|
||
public function MatchingExpressions() |
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.
getMatchingExpressions()
tres bien 👍 |
$this->assertFalse($expressionRequestMatcher->matches($request)); | ||
} | ||
|
||
public function getExpressions() |
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.
you are not only getting Expressions now but a vector of expressions and their expected matching result so adapt the name accordingly
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.
provideExpressionData() ?
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 think provideExpressions()
would be fine.
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.
@jakzal done, thank you.
$expressionRequestMatcher = new ExpressionRequestMatcher(); | ||
|
||
$expressionRequestMatcher->setExpression(new ExpressionLanguage(), $expression); | ||
$this->assertEquals($expressionRequestMatcher->matches($request), $expected); |
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.
Wrong order of the arguments for all assertions.
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.
should be same as $expected
is a Boolean.
…ests (inalgnu) This PR was submitted for the 2.4-dev branch but it was merged into the 2.4 branch instead (closes #10322). Discussion ---------- [HttpFoundation][Tests] Add expression request matcher tests | Q | A | ------------- | --- | Bug fix? | no | New feature? | no | BC breaks? | no | Deprecations? | no | Tests pass? | yes | Fixed tickets | n/a | License | MIT | Doc PR | n/a Commits ------- 76fe21d [HttpFoundation][Tests] add expression request matcher tests