CodeIgniter Forums
Toast Patch for Code Igniter 2/PHP5 - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20)
+--- Forum: Archived General Discussion (https://forum.codeigniter.com/forumdisplay.php?fid=21)
+--- Thread: Toast Patch for Code Igniter 2/PHP5 (/showthread.php?tid=39360)



Toast Patch for Code Igniter 2/PHP5 - El Forum - 03-08-2011

[eluser]Unknown[/eluser]
Hi,

I am a complete newby with CI. I was struggling to setup unit tests using Toast 1.5, but just got it sorted. On my setup (Codeigniter 2, PHP5.2.15, Ubuntu 10.10) i needed to make the following changes to get the example tests working;

Toast.php

Change the constructor from;

Code:
abstract class Toast extends Controller
{

...

function Toast($name)
{
    parent::Controller();
...
}

TO...

Code:
//changed baseclass name
abstract class Toast extends CI_Controller
{

...

//changed constructor function name
function __construct($name)
{
    parent::__construct(); //changed parent constructor name
...
}

also had to change example_tests from

Code:
function Example_tests()
{
    parent::Toast(__FILE__);
    // Load any models, libraries etc. you need here
}

to

Code:
function __construct() // change constructor method name
{
   parent::__construct(__FILE__); //changed parent constructor method name
    // Load any models, libraries etc. you need here
}

I hope this helps someone who has been tearing their hair out like I have. I am sure I got something simple wrong here, but it works now.