Welcome Guest, Not a member yet? Register   Sign In
i18n library and CIUnit
#1

[eluser]Unknown[/eluser]
The default i18n integration with CIUnit causes phpunit to terminate without any output or debugging information. I spent sometime debugging. The following are my changes to get them working correctly.

from:
Code:
function MY_Lang()
...
      if ((!$url_ok) && (!$this->is_special($uri_segment['parts'][0]))) // special URI -> no redire\
ct                                                                                                  
        {
          // set default language                                                                  
          $CFG->set_item('language', $this->languages[$this->default_lang()]);

          $uri = (!empty($this->uri)) ? $this->uri: $this->default_uri;
          $uri = ($uri[0] != '/') ? '/'.$uri : $uri;
          $new_url = $CFG->config['base_url'].$this->default_lang().$uri;

          header("Location: " . $new_url, TRUE, 302);
          exit;
        }
}

to:

Code:
function MY_Lang()
...
      if (defined('CIUnit_Version') === FALSE && (!$url_ok) && (!$this->is_special($uri_segment['parts'][0]))) // special URI -> no redire\
ct                                                                                                  
        {
          // set default language                                                                  
          $CFG->set_item('language', $this->languages[$this->default_lang()]);

          $uri = (!empty($this->uri)) ? $this->uri: $this->default_uri;
          $uri = ($uri[0] != '/') ? '/'.$uri : $uri;
          $new_url = $CFG->config['base_url'].$this->default_lang().$uri;

          header("Location: " . $new_url, TRUE, 302);
          exit;
        }
}

I hope others can find this change useful.
CI Version: 2.1.0




Theme © iAndrew 2016 - Forum software by © MyBB