Welcome Guest, Not a member yet? Register   Sign In
How to testing code modules?
#1

I created an authentication library for CI4 as code module, now i would like to unit testing the module. But the documentation does not provide guidelines for unit testing for libraries. For unit testing for code modules, there is no guide at all.

My application structure:
application
auth
--MyAuth
----Config
------MyAuth_config.php
----Controllers
------MyAuth_ctrl.php
----Helpers
----Language
------en
--------MyAuth_lang.php
----Libraries
------MyAuth.php
public
system
tests
--system
--_support
--auth <-- I would like to write tests in this folder
vendor
writable
Reply
#2

What specific guidance are you looking for? You would test that, using phpunit provided, like you would test any class. The testing tools aren't complete yet, but you can look at any of the tests in /system to see how to use things. You can also test controllers, and more with the existing tools. I'm very close to having HTTP testing tools ready, which included a refactor of how some of the core code worked to make testing even easier, and hope to have that pushed to the repo by the end of the week. Having to update all of the other tests in the system to work with the refactored CodeIgniter.php and CIUnitTestCase. And I need to write up that docs for it. Smile

If you have specific questions we can be of more help.
Reply




Theme © iAndrew 2016 - Forum software by © MyBB