I have installed Codeigniter 3 Release in my project then i enable session library in config/autolad.php but when i run my test, i always get the error "Unable to locate the specified class: Session.php".
this is my phpunit.xml
<?xml version="1.0" encoding="UTF-8" ?>
<phpunit bootstrap="application/tests/bootstrap.php">
<testsuites>
<testsuite name="TestSuite">
<directory>application/tests</directory>
</testsuite>
</testsuites>
<php>
<const name="PHPUNIT_TEST" value="1" />
<const name="PHPUNIT_CHARSET" value="UTF-8" />
<server name="REMOTE_ADDR" value="0.0.0.0" />
</php>
<filter>
<blacklist>
<directory suffix=".php">system</directory>
<!--directory suffix=".php">application/libraries</directory-->
</blacklist>
</filter>
</phpunit>
and this is my application/test/bootstrap.php to integrate codeigniter & phpunit
<?php
/*
*---------------------------------------------------------------
* OVERRIDE FUNCTIONS
*---------------------------------------------------------------
*
* This will "override" later functions meant to be defined
* in core\Common.php, so they throw erros instead of output strings
*/
function show_error($message, $status_code = 500, $heading = 'An Error Was Encountered')
{
throw new PHPUnit_Framework_Exception($message, $status_code);
}
function show_404($page = '', $log_error = TRUE)
{
throw new PHPUnit_Framework_Exception($page, 404);
}
/*
*---------------------------------------------------------------
* BOOTSTRAP
*---------------------------------------------------------------
*
* Bootstrap CodeIgniter from index.php as usual
*/
require_once dirname(__FILE__) . '/../../index.php';
/*
* This will autoload controllers inside subfolders
*/
spl_autoload_register(function ($class) {
foreach (glob(APPPATH.'controllers/**/'.ucfirst(strtolower($class).'.php')) as $controller) {
require_once $controller;
}
//kreasi sendiri
foreach (glob(APPPATH.'controllers/'.ucfirst(strtolower($class).'.php')) as $controller) {
require_once $controller;
}
});
anybody can help me?
@gopakumar-gopalan, i did as you say, and here what i've got :
<?php defined('BASEPATH') OR exit('No direct script access allowed'); ?>
INFO - 2015-02-03 04:52:10 --> Config Class Initialized
INFO - 2015-02-03 04:52:10 --> Hooks Class Initialized
DEBUG - 2015-02-03 04:52:10 --> UTF-8 Support Enabled
INFO - 2015-02-03 04:52:10 --> Utf8 Class Initialized
INFO - 2015-02-03 04:52:10 --> URI Class Initialized
DEBUG - 2015-02-03 04:52:10 --> No URI present. Default controller set.
INFO - 2015-02-03 04:52:10 --> Router Class Initialized
INFO - 2015-02-03 04:52:10 --> Output Class Initialized
INFO - 2015-02-03 04:52:10 --> Security Class Initialized
DEBUG - 2015-02-03 04:52:10 --> Global POST, GET and COOKIE data sanitized
INFO - 2015-02-03 04:52:10 --> Input Class Initialized
INFO - 2015-02-03 04:52:10 --> Language Class Initialized
INFO - 2015-02-03 04:52:10 --> Loader Class Initialized
INFO - 2015-02-03 04:52:10 --> Helper loaded: url_helper
INFO - 2015-02-03 04:52:10 --> Helper loaded: date_helper
DEBUG - 2015-02-03 04:52:10 --> Session: Initialization under CLI aborted.
INFO - 2015-02-03 04:52:10 --> Database Driver Class Initialized
INFO - 2015-02-03 04:52:10 --> Controller Class Initialized
INFO - 2015-02-03 04:52:10 --> Model Class Initialized
INFO - 2015-02-03 04:52:10 --> Model Class Initialized
INFO - 2015-02-03 04:52:10 --> Helper loaded: form_helper
INFO - 2015-02-03 04:52:10 --> File loaded: /var/www/sitahta.local/public_html/application/views/core/header.php
INFO - 2015-02-03 04:52:10 --> File loaded: /var/www/sitahta.local/public_html/application/views/core/footer.php
INFO - 2015-02-03 04:52:10 --> File loaded: /var/www/sitahta.local/public_html/application/views/core/alert.php
INFO - 2015-02-03 04:52:10 --> File loaded: /var/www/sitahta.local/public_html/application/views/login/index.php
INFO - 2015-02-03 04:52:10 --> Final output sent to browser
DEBUG - 2015-02-03 04:52:10 --> Total execution time: 0.0990
i see there are debug log say 'Session: Initialization under CLI aborted.', is this the cause for the error?