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

Appearance settings

[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

Closed

Conversation

inelgnu
Copy link
Contributor

@inelgnu 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));

Copy link
Contributor

Choose a reason for hiding this comment

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

remove this line break

@inelgnu
Copy link
Contributor Author

inelgnu commented Feb 24, 2014

@cordoval i have add data providers.
any suggestions for method names ? it is used to test the ExpressionRequestMatcher matches() method when the parent matches return True/False

$expressionRequestMatcher->matches(new Request());
}

public function MatchingExpressions()
Copy link
Contributor

Choose a reason for hiding this comment

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

getMatchingExpressions()

@cordoval
Copy link
Contributor

tres bien 👍

$this->assertFalse($expressionRequestMatcher->matches($request));
}

public function getExpressions()
Copy link
Contributor

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

Copy link
Contributor Author

Choose a reason for hiding this comment

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

provideExpressionData() ?

Copy link
Contributor

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.

Copy link
Contributor Author

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);
Copy link
Member

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.

Copy link
Member

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.

fabpot added a commit that referenced this pull request Mar 3, 2014
…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
@fabpot fabpot closed this Mar 3, 2014
@inelgnu inelgnu deleted the expression-request-matcher-test branch March 3, 2014 17:48
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
Morty Proxy This is a proxified and sanitized view of the page, visit original site.