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

HTTP Feature Testing not working #1710

Closed
diegoldev opened this issue Feb 8, 2019 · 9 comments
Closed

HTTP Feature Testing not working #1710

diegoldev opened this issue Feb 8, 2019 · 9 comments
Assignees
Labels
in progress testing Pull requests that changes tests only

Comments

@diegoldev
Copy link
Contributor

diegoldev commented Feb 8, 2019

Description of the bug
I'm working with appstarter project and when I try to run phpunit, i found serveral errors:

  1. 'tests' folder is not included in the composer download, I could create it but, beyond functioning as a container of tests files, it has the '_support' folder which contain _bootstrap.php that help unit tests be executed correctly.
  2. In order to fix the previous error, I downloaded manually 'tests' folder from develop branch. After that, I try to execute a test using HTTP Feature Testing but it throwing the above error:
Tests\TestHome::testIndex
CodeIgniter\Exceptions\PageNotFoundException: Controller or its method is not found: App\Controllers\\Http:::ci4.extctrl.docker:8080

/var/www/html/ci4-extendedcontroller/vendor/codeigniter4/framework/system/Exceptions/PageNotFoundException.php:14
/var/www/html/ci4-extendedcontroller/vendor/codeigniter4/framework/system/CodeIgniter.php:889
/var/www/html/ci4-extendedcontroller/vendor/codeigniter4/framework/system/CodeIgniter.php:249
/var/www/html/ci4-extendedcontroller/vendor/codeigniter4/framework/system/Test/FeatureTestCase.php:122
/var/www/html/ci4-extendedcontroller/tests/TestHome.php:21 

CodeIgniter 4 version
CodeIgniter 4.0.0-alpha.5 (appstarter, framework and devstarter projects)

Affected module(s)
HTTP Feature Testing

Expected behavior, and steps to reproduce if appropriate
I've described further the behavior in this forum post
Context

  • OS: Debian (running in Docker over Windows 10)
  • Web server: Apache 2.4.5 (Debian)
  • PHP version: 7.3.1
@jim-parry
Copy link
Contributor

The tests folder in the develop branch is for unit testing the framework itself, NOT your app. It is pusposefully not included in the appstarter distribution!
If you want to crete unit tests for your app, you need to create your own tests folder, and your tests would go inside tests/app
"App\Controllers\Http:::ci4.extctrl.docker:8080" indicates that your test code might be suspect, rather than any bug in the framework. We can address this further on the forum.

@diegoldev
Copy link
Contributor Author

@jim-parry Okay, so, what about 'test documentation'? Is intended to test my app or is for test the framework? Following that instructions it not seems to work app unit testing. Is there any full example of a working app uni test?

@jim-parry
Copy link
Contributor

That test documentation is for testing your app, not the framework. See my response to yor forum thread.

@lonnieezell
Copy link
Member

@jim-parry Looking at this, we do need to include the tests/_support folder as part of it. All of the things that make testing work, even for the application, require some of the stuff in that folder.

While I think there's stuff that's not necessary and is just for framework development, it doesn't hurt to include it. Would be cleaner to separate it out but probably a giant pain to do so.

At the very least, though, the following files are required for testing an application (I might have missed some):

  • _bootstrap.php
  • CIDatabaseTestCase.php
  • CIUnitTestCase.php
  • Log/TestLogger.php
  • DOM/DomParser.php - though that should probably be moved into system/Tests honestly.
  • Events/MockEvents.php (I think0
  • Helpers/* - these should probably also be in system/Tests

Quite a few of the other Mock* classes might prove useful to people when testing their apps, but less critical.

@lonnieezell lonnieezell reopened this Feb 9, 2019
@jim-parry
Copy link
Contributor

Alright ... I will play with this :)

@jim-parry jim-parry added the missing feature Reported issue which is not a bug but needs to be implemented label Feb 9, 2019
@jim-parry jim-parry added this to the 4.0.0 milestone Feb 9, 2019
@jim-parry jim-parry self-assigned this Feb 13, 2019
@jim-parry
Copy link
Contributor

I have jiggered some of the support test files, and the distribution build scripts. This should work better "out of the box" with the next release. I think it wise to wait for that for thorough testing, as there are other changes that will be part of it.

@jim-parry jim-parry added testing Pull requests that changes tests only in progress and removed missing feature Reported issue which is not a bug but needs to be implemented labels Feb 18, 2019
@jim-parry jim-parry modified the milestones: 4.0.0, 4.0.0-beta.2 Mar 5, 2019
@atishhamte
Copy link
Contributor

@jim-parry, any success as it might delay the release of beta 2.

@jim-parry
Copy link
Contributor

This is the set of tests I am working on at the moment :)

@jim-parry
Copy link
Contributor

The changes discussed here have been done. The Controller/Feature testing is a separate issue, and still in progress.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
in progress testing Pull requests that changes tests only
Projects
None yet
Development

No branches or pull requests

4 participants