after that you can use assert Class to do unit Testing test cases. However you need to load unitTest module to do unit testing. even if you forget/dont load the unitTest module nither PHP nor zigmoyd will fire any error cause the then a dummy unitTest module will be used which have a dummy assert class that does nothing. e.g. use
<?php class someController extends homeController{ public function myMethod(){ $this->load->module('unitTest');//Load the unit testign module $x = 2; assert::valid(($x == 2), "X is not equal to 2", __FILE__, __LINE__); $y = array(); assert::strict((is_array($y)), "Y is not an array", __FILE__, __LINE__); } } ?>
http://localhost/zigmoyd/some/my
to invoke the code no unit test result set will be genareted cause a page will be used for 1000 times a day so its not fair to generate a unit testing result sheet everytime.?u
GET variable at the end of the url to enable unit testing.e.g. http://localhost/zigmoyd/some/my?u
when the ?u
is given the unit test will be done else not.
However if you want (RECOMENDED) you can change the u
to a different unit testing key. by changing the value of UNIT_GET_KEY
in etc/unittest.ini.php
file in your project's directory.
every unittest Session have an Test Id. if you just pass ?u
the session ID of that Test session will be the Current timestamp. But if you Specify a custom session id as ?u=MYSESSIONIDNAME
that test session will be named as MYSESSIONIDNAME
to view an unit testing result you need to go to the uSess
method through your browser. e.g. as here the controller name is some
you need to go to http://localhost/zigmoyd/some/uSess/MYSESSIONIDNAME
e.g. pass the Session ID. if you havn't used any session ID use the timeStamp. However its always preferable to use a custom Session Id.
UNIT_GET_KEY
in etc/unittest.ini.php
file in your project's directory as told above