CodeIgniter Forums
TOAST and CI 3 - Printable Version

+- CodeIgniter Forums (
+-- Forum: Using CodeIgniter (
+--- Forum: General Help (
+--- Thread: TOAST and CI 3 (/showthread.php?tid=65788)

TOAST and CI 3 - ComputingFroggy - 07-24-2016


I am trying to use TOAST to perform Unit Testing with a lightweight library.

I have managed to get it to work, but I still have a couple of questions (which more CI related than pure TOAST).

Here is an example of a class (don't look at the test ... it's just for testing ;-) TOAST):
PHP Code:
('BASEPATH') OR exit('No direct script access allowed');

APPPATH '/controllers/test/Toast.php');
APPPATH '/controllers/Calendrier.php'); //Require the tested class's file

class Calendrier_test extends Toast
__construct() {
$this->theController = new Calendrier(true); //Instantiate class
_pre() {
//Prepare unit test user database entry

test_index() {
$theCount 0;$this->message '';
 foreach (
$this->theController->Reservation_model->getAllResType() as $row) {
$this->message .= ' val = ' $row->typ_nm
$this->message .= '  $theCount = ' $theCount

_post() {
//Remove unit test office from database

First of all in autoload.php I have this line:
PHP Code:
$autoload['libraries'] = array('database' ,'firePHP''ion_auth'); 
But I had to remove the last 2 libs as they won't get loaded, I get the error message :
Quote:Severity: Error
Message: Class 'CI_FirePHP' not found
Filename: core/Common.php
Line Number: 196
Any idea on how to fix this ?

One thing that I don't understand, is that I have to instantiate the controler (with variable $theControler) and to load the model !
I understand that I need to load the model, but then, why I can not write :
PHP Code:
(this generates the following error :
Quote:Severity: Notice
Message: Undefined property: Calendrier_test::$Reservation_model
Filename: test/Calendrier_test.php

And last but not least, the Toast_all method generates an error 403 You don't have permission to access /test/Calendrier_test/show_results . Permissions were set to 777 for all directories and files and I still get the error. The Toast_all is using curl.
I have asked the maintainer but I am asking here too ... just in case.

Thanks in advance for any reply (even for only one of the points),
[email protected]

RE: TOAST and CI 3 - ComputingFroggy - 07-29-2016

I've fixed the Toast_all URL problem (related to the way CURL was called).

The two others problem are related to the way controler/model are tested and the tested class being instantiated in the constructor.

I am hoping to get a good example of doing this, but if someone has an example of testing classes, it will be great.