Namespaced Tests |
Resurrecting this thread as it still baffles me. Now that I am more experience with the framework and have developed some addins, I think I would like to consider testing in three scenarios:
Scenario one seems to me that it is covered pretty well in the docs (https://codeigniter4.github.io/CodeIgnit...rview.html): you add test cases into /tests and use the existing phpunit.xml.dist (or write your own) to run these tests. Scenarios two and three I think are currently possible but not documented or immediately apparent to someone (like me) who is new to testing. With CI4 grown more modular as it develops I believe these could use some attention. Scenario two most fits a developer working on a module. Some modules could use raw PHPUnit and have test ignorant of the framework, but in most cases the module will include framework features like models and routing that cannot be tested without including the framework itself. In this case we need some way of installing the framework (e.g. `composer require --dev codeigniter4/framework`) and then some unspecified means of loading and namespacing it properly without necessarily installing or configuring it. Scenario three most fits a developer wanting to use a module, or test its compatibility with an existing project. In a development instance the dev would `composer require foo/bar` and then somehow be able to run pre-written tests from the Foo\Bar\Tests namespace. Just to note, Myth:Auth has an example of some of what Scenario Two needs but since it is still in production I'm not sure @kilishan would consider this "the right way". |
Messages In This Thread |
Namespaced Tests - by MGatner - 03-31-2019, 06:47 AM
RE: Namespaced Tests - by ciadmin - 03-31-2019, 07:37 AM
RE: Namespaced Tests - by MGatner - 03-31-2019, 09:25 AM
RE: Namespaced Tests - by ciadmin - 03-31-2019, 10:35 AM
RE: Namespaced Tests - by MGatner - 03-31-2019, 01:39 PM
RE: Namespaced Tests - by ciadmin - 03-31-2019, 01:48 PM
RE: Namespaced Tests - by MGatner - 07-02-2019, 07:44 AM
|