Skip to content
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

Integration testing: Nette\Application\Request POST data are not handled in InputFactory #63

Open
klimesf opened this issue Mar 7, 2015 · 1 comment

Comments

@klimesf
Copy link
Contributor

klimesf commented Mar 7, 2015

When testing presenters, I create a Nette\Application\Request and let the presenter run it. However, this way the ResourcePresenter::input doesn't contain the POST data sent in the request.

I did some research and found that InputFactory parses POST data from Nette\Http\Request, which is fine when using the API via HTTP calls.

I can make a PR, where Nette\Application\Request would get injected into the InputFactory and the POST data would be extracted from it, rather than from Nette\Http\Request. Do you think this would be a good solution?

@drahak
Copy link
Owner

drahak commented Mar 7, 2015

The main purpose of Input factory is to actually parse the request body using mapper (according to Content-Type header). The request body may be in various formats (such as JSON). Getting data from Application Request would work for data URL format only.

Possible solution would be to add Input factory interface so you can create your own input factory for tests.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants