I am working with a codeigniter php script, which has a number of controllers which run daily, using cronjobs. Part of the input to some of these controllers is dependent on date. As part of my testing I need to evaluate the behavior of the script over a number of days.
Is there a way to set the date globally within my dev environment perhaps at the level of the php.ini file in order to test the activity over different dates?
I think, you can define in corre controller and extend all your controller from core controller.
In application/core
create a file by name MY_Controller.php
(be carefull about name)
Next in core controller
class MY_Controller extends CI_Controller
{
function __construct()
{
parent::__construct();
// set your default time zone here
}
}
Next in all controllers where you want to set default timezone, just extend from core controller like this
class ClassName extends MY_Controller {