[eluser]rubdottocom[/eluser]
Hi!
Whoah Kenji, thanks for the amazing work!
I'm close to make it work, I have a problem with a simple test of a controller
This is my controller
Code:
<?php
if ( ! defined('BASEPATH')) exit('No direct script access allowed');
class Home extends MY_Controller {
function __construct()
{
parent::__construct();
$this->load->helper('json');
}
public function view($page = 'home')
{
log_message('debug', 'Page: '. $page);
if ( ! file_exists('application/views/pages/'.$page.'.php'))
{
show_404(); // Whoops, we don't have a page for that!
}
$data['sections'] = $this->get_sections_master();
$this->load->view('templates/header', $data);
$this->load->view('templates/sidebar', $data);
$this->load->view('pages/'.$page, $data);
$this->load->view('templates/footer', $data);
}
... Other stuff
And this my test:
Code:
<?php
/**
* @group Controller
*/
class SomeControllerTest extends CIUnit_TestCase
{
public function setUp()
{
// Set the tested controller
$this->CI = set_controller('Home');
}
public function testWelcomeController()
{
// Call the controllers method
//$this->CI->index();
$this->CI->view('home');
// Fetch the buffered output
$out = output();
// Check if the content is OK
$this->assertSame(0, preg_match('/(error|notice)/i', $out));
}
}
When I run phpunit I receive 404 Message because the
Code:
if ( ! file_exists('application/views/pages/'.$page.'.php'))
But the file exists and if I try to open in a browser works fine, I miss something? :-(