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

Base FeatureTestCase on CIUnitTestCase #2172

Merged
merged 1 commit into from Aug 28, 2019

Conversation

jim-parry
Copy link
Contributor

FeatureTestCase extended CIDatabaseTestCase, even though there were no data calls.
This prevented testing features if the database tests weren't also being run.

@jim-parry jim-parry merged commit a8357ed into codeigniter4:develop Aug 28, 2019
@jim-parry jim-parry deleted the featuretest branch August 28, 2019 23:45
@lonnieezell
Copy link
Member

@jim-parry This is not the solution for your problem. Feature tests have to extend from the DatabaseTestCase since the entire reason for Feature Testing is to test a URL and check the response, which most of the times requires some kind of database setup first.

You can always set $refresh = false on the test class to turn off running migrations. If there's another issue you're running into, then we need to find a way to turn that feature off in FeatureTestCase.

@jim-parry
Copy link
Contributor Author

@lonnieezell Hmmm - there is nothing in FeatureTestCase or FeatureTestCaseTest that suggests any need for a database, and I am not sure it reasonable to expect that any URL test will of necessity require a database.
Having FeatureTestCase extend CIDatabaseTestCase breaks URL testing with no database connection, hence my NakedFeatureTestCase, which is identical (as you point out) except that it has no database conenction.
Maybe FeatureTestCase should be a trait instead, so that it could used with or without a database test? That might help those who persist data using a document store or XML, rather than a relational database.

I will revert the change, and figure out a different way to test a generic RESTful resource.

@lonnieezell
Copy link
Member

A trait would be a fine solution.

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.

None yet

2 participants