1 <?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
2
3 class Test extends CI_Controller {
4 5 6
7 public function __construct() {
8 parent::__construct();
9 $this->load->driver('Unit_tests');
10 }
11
12 13 14 15 16 17
18 public function index() {
19
20 $this->load->library('session');
21 $this->session->set_userdata('dest_url', $this->config->item('base_url') . '/test');
22 if ($this->session->userdata('role_slug') != DB_SLUG_ADMIN) {
23 header('Location: ' . $this->config->item('base_url') . '/user/login');
24 return;
25 }
26
27 if (ENVIRONMENT !== 'development') {
28 $this->output->set_output('Tests are available only at development environment. '
29 . 'Please check your "index.php" file settings.');
30 return;
31 }
32
33 $this->load->view('general/test');
34 $this->unit_tests->run_all_tests();
35 }
36
37 38 39
40 public function models() {
41
42
43 }
44
45 46 47
48 public function libraries() {
49
50
51 }
52 }
53
54
55