Skip to content

Use null coalescing to routes resolution in FeatureTestTrait::call #3570

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

Merged
merged 3 commits into from
Aug 31, 2020
Merged

Use null coalescing to routes resolution in FeatureTestTrait::call #3570

merged 3 commits into from
Aug 31, 2020

Conversation

paulbalandan
Copy link
Member

Description
This change will allow us to not be constrained in using FeatureTestTrait within the context only of FeatureResponse. We can also use this on other test cases, like CIUnitTestCase. This also resolves phpstan's error "Ternary operation always return true."

Checklist:

  • Securely signed commits
  • Component(s) with PHPdocs
  • Unit testing, with >80% coverage
  • User guide updated
  • Conforms to style guide

Copy link
Member

@MGatner MGatner left a comment

Choose a reason for hiding this comment

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

If one of the intents is to be able to run this trait on CIUnitTest could you maybe add an example as a test case?

@paulbalandan
Copy link
Member Author

Sure do.

@paulbalandan
Copy link
Member Author

I'm confused. HomeTest does not fail locally.

PS C:\Users\P\Desktop\Web Dev\CodeIgniter4> vendor/bin/phpunit -v --filter HomeTest
PHPUnit 8.5.8 by Sebastian Bergmann and contributors.

Runtime:       PHP 7.4.9 with Xdebug 2.9.6
Configuration: C:\Users\P\Desktop\Web Dev\CodeIgniter4\phpunit.xml

.                                                                   1 / 1 (100%)

Time: 58.65 seconds, Memory: 52.00 MB

OK (1 test, 1 assertion)

@michalsn
Copy link
Member

@paulbalandan It was failing because we use Services::reset() in other tests. And it wipes out the default routes config.

@michalsn michalsn merged commit 8c90aa0 into codeigniter4:develop Aug 31, 2020
@paulbalandan paulbalandan deleted the featuretesttrait-routes branch August 31, 2020 19:56
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

Successfully merging this pull request may close these issues.

3 participants