Hi,
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):
First of all in autoload.php I have this line:
But I had to remove the last 2 libs as they won't get loaded, I get the error message :
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 :
(this generates the following error :
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),
L@u
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:
<?php
defined('BASEPATH') OR exit('No direct script access allowed');
require_once(APPPATH . '/controllers/test/Toast.php');
require_once(APPPATH . '/controllers/Calendrier.php'); //Require the tested class's file
class Calendrier_test extends Toast
{
private $theController;
function __construct() {
parent::__construct(__FILE__);
$this->theController = new Calendrier(true); //Instantiate class
}
function _pre() {
//Prepare unit test user database entry
}
function test_index() {
$this->load->model('Reservation_model');
$theCount = 0;$this->message = '';
foreach ($this->theController->Reservation_model->getAllResType() as $row) {
$this->message .= ' val = ' . $row->typ_nm;
$theCount++;
}
$this->message .= ' $theCount = ' . $theCount;
$this->_assert_equals($theCount, 2);
}
function _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');
Quote:Severity: ErrorAny idea on how to fix this ?
Message: Class 'CI_FirePHP' not found
Filename: core/Common.php
Line Number: 196
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->Reservation_model->getAllResType()
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),
L@u