NEKOGET Report

日本語 english

-

[2] Goodby var_dump! Welcome Profiler of CodeIgniter!!!

This is a continuance of the last report.
http://press.nekoget.com/report/detail/1008/en

I expanded CI_Profiler Class.
I think that I must not be able to see profiler with the genuine server.

file path : application/libraries/MY_Profiler.php
The function that I added a hand to is run().

....Omission....
 public function run()
 {
  if($this->CI->config->item("genuine_url")
   && $this->CI->config->item("genuine_url") == $this->CI->config->item("base_url")
   )
   {
    return FALSE;
   }
 ....Omission....
 }


I wrote $config["genuine_url"] on config.php.
If I did not write it,I take this as a development environment and should display a result of profiler.

Because I wrote it, it answers false if I judged it with genuine environment, and It should answer a result of profiler if it is environment of the development.

Because Profiler Class serves as a duty, I can write it in this way.
$this->output->enable_profiler();
Movie on USTREAM
This animation is Sheen who clicked a button.
Because there is much quantity, the result of profiler comes to be closed if I click a result.

Let's Unit test!
You must not say that you were able to put work away till you finish writing a test.

I prepare Controller file to write unit test.

* I use 'Modular Extensions - HMVC'. I made a Test Module.
It divides a test file and the program code of the main body.
Filing it has to devise it to name it,If you did not use 'Modular Extensions - HMVC'.
I suggest it and do the top of the name of the file in 'test_'


....Omission....
//
$this->load->config("profiler_config1");
//Lode profiler
$this->load->library('profiler');
$ck = $this->profiler->run();
$title["comment"] = "this code on genuine ";
$title["site_url"] = $this->config->item("base_url");
$title["genuine_url"] = $this->config->item("genuine_url");
//unit test
unit->run($ck, 'is_false', $title["comment"] ,$this->_title($title));
echo br();

//
//Lode Config file
$this->load->config("profiler_config2");
//Lode Profiler
$this->load->library('profiler');
$ck = $this->profiler->run();
$title["comment"] = "on development";
$title["site_url"] = $this->config->item("base_url");
$title["genuine_url"] = $this->config->item("genuine_url");
//unit test
echo $this->unit->run($ck, 'is_string', $title["comment"] ,$this->_title($title));
echo $ck;
....Omission....


The next picture is really the screen which performed unit test.
*It is Test Module which I made.

Because I make this by Japanese setting, the letter of the screen is Japanese.
テスト結果

Creation data : 2011-05-26 10:16

Last update : 2011-05-26 10:16

-

-