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

Dispatching the Symfony\Component\HttpFoundation\Request during Unit Tests is not working correctly when compared to using Postman #990

Closed
Hell4Ge opened this issue Oct 16, 2019 · 3 comments

Comments

@Hell4Ge
Copy link

Hell4Ge commented Oct 16, 2019

  • Lumen Version: Laravel Framework Lumen (6.2.0) (Laravel Components ^6.0)
  • PHP Version: php:7.3-fpm-stretch (docker image)
  • Database Driver & Version: none

Description:

Dispatching the object of Request::create(...) works as expected using Postman, but not during unit tests.

Steps To Reproduce:

Ensure the port 8080 is free or change it in docker-compose.yml file

git clone https://github.com/Hell4Ge/lumenbug-1.git
cd lumenbug-1/.docker/ && docker-compose -p lumenbug-1 up -d --build
docker exec lumenbug-1_php_1 cp .env.example .env
docker exec lumenbug-1 composer update
docker exec lumenbug-1_php_1 vendor/bin/phpunit

The failure of unit test is expected as it is a proof, the result is different from executing a POST request to http://localhost:8080/anotherExampleRoute using Postman.

Use Case

I am designing the API that needs to call other routes from single route as its easier to rollback the database and storage if something fails. As long as this bug persists I am not able to test if efficiently

Side notes

Happened also on 5.* version of Lumen, I noticed that once the unit test has been run then some of the things stays the same, like the providers seems to do not run again with every next request (ie. you cannot change user by sending different token in future requests, instead you HAVE TO use actingAs method which was not in my favor as it was quite custom login method).

@driesvints
Copy link
Member

Hey there,

Can you first please try one of the support channels below? If you can actually identify this as a bug, feel free to report back and I'll gladly help you out and re-open this issue.

Thanks!

@Hell4Ge
Copy link
Author

Hell4Ge commented Oct 17, 2019

Hey there,

Can you first please try one of the support channels below? If you can actually identify this as a bug, feel free to report back and I'll gladly help you out and re-open this issue.

Thanks!

I don't understand, are you trying to make me believe its not a bug, but a feature? Where can I find somebody to help me "identify this as a bug" if not here

@driesvints
Copy link
Member

@Hell4Ge on the channels I listed above

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