SimpleTest with CodeIgniter - won't identify file variables?

I am trying to use SimpleTest with CodeIgniter using the code provided by maroonbytes . I am using LAMP and NetBeans 6.9.

The test.php page loads in my browser. I have a stub test and it is displayed in a drop down list. When I try to run it, I get 2 PHP errors:

Message: include_once (/var/www/sparts3/main/tests/basic_test_v.php): could not open the stream: there is no such file or directory

Message: include_once (): Failed to open '/var/www/sparts3/main/tests/basic_test_v.php' for inclusion (Include_path = ': / USR / share / PHP: / USR / share / pear')

The path is wrong - basic_test_v.php is located in the / tests / views subfolder .

The debugger points this out in test.php :

function add_test($file, &$test)

For some reason, NetBeans is not revealing the value of $ file at the moment. Does this mean that it is empty?

I already ran a line of code because I managed to get past the 404 code. Page not found. the GET debugger seemed to make the validator fail. So I added the criteria, in my uninformed way (I'm sure this should be a handled exception or something else):

if ($this->uri->uri_string == '' || $this->uri->uri_string == 'XDEBUG_SESSION_START')
    {   ...  }

How can i solve this? BTW, this is an attempt to solve my other post , which I will update; it would seem better to make this a discrete question.


1: - (Firefox) POST. , . - , NetBeans ; .

2: , . NetBeans . test.php. add_test ($ file, & $test). if; , . if:

if (file_exists($implementation))
{
    require_once ($implementation); ...

, :

  • NetBeans SuperGlobals
  • , $ -

:

$implementation = 'http://var/www/sparts3/main/tests/views/basic_test_view.php';

. , NetBeans/Xdebug .

, PHP. ? - , CI .


3: WAMP. ( "" , - PHP 4 5). , ( Xdebug ), , , .

0
2

basic_test_v.php basic_test_view.php? , .

1 ( )

404 . , GET . , ( , - ):

if ($this->uri->uri_string == '' || $this->uri->uri_string == 'XDEBUG_SESSION_START') {   ...  }

? , , ; .

"" : $config['uri_protocol'] = "AUTO"; $config['uri_protocol'] = "PATH_INFO"; $config['enable_query_strings'] = FALSE; $config['enable_query_strings'] = TRUE; config.php( , )

test.php , :

% name% _% type% _test.php(% type% )

:

, welcome.php welcome_controller _test.php //

test.PHP . , , .

get_loader_id add_test,

function get_loader_id($file, $type) {
   $loader_id = str_replace("_{$type}_test.php", "", basename($file));
   return $loader_id;
}
function add_test($file, &$test) {
   $implementation = '';
   if (preg_match('/_controller/', $file)) {
      $controller = get_loader_id($file, 'controller');
      $implementation = APPLICATION . 'controllers/' . $controller . '.php';
   } elseif (preg_match('/_model/', $file)) {
      $model = get_loader_id($file, 'model');
      $implementation = APPLICATION . 'models/' . $model . '_model.php';
   } elseif (preg_match('/_view/', $file)) {
      $view = get_loader_id($file, 'view');
      $implementation = APPLICATION . 'views/' . $view . '.php';
   } elseif (preg_match('/_helper/', $file)) {
      $helper = get_loader_id($file, 'helper');
      $implementation = APPLICATION . 'helpers/' . $helper . '.php';
   } elseif (preg_match('/_library/', $file)) {
      $library = get_loader_id($file, 'library');
      $implementation = APPLICATION . 'libraries/' . $library . '.php';
   }
   if (file_exists($implementation)) {
      require_once ($implementation);
   }
   $test->addFile($file);
}

, ( macbook zend server ce, xdebug, simpletest netbeans 6.9)

+1

, $this->load->view('basic_test_view');?

0

Source: https://habr.com/ru/post/1745683/


All Articles