public function process()
  {
    $this->counter = 0;

    if(sizeof($this->filters) > 0)
    {
      resolveHandle($this->filters[0]);
      $this->filters[0]->run($this, $this->request, $this->response);
    }
  }
  static protected function _includeClassFile($class_name)
  {
    if(class_exists($class_name))
      return;

    resolveHandle($resolver =& getFileResolver('site_object'));

    $full_path = $resolver->resolve($class_name);

    include_once($full_path);
  }
  static protected function _includeClassFile($db_table_name)
  {
    if(class_exists($db_table_name . 'DbTable'))
      return;

    resolveHandle($resolver =& getFileResolver('db_table'));

    $full_path = $resolver->resolve($db_table_name);

    include_once($full_path);
  }
예제 #4
0
  protected function _getPath($file_name, $locale_id)
  {
    if(isset($this->_path_cache[$file_name][$locale_id]))
      return $this->_path_cache[$file_name][$locale_id];

    resolveHandle($resolver =& getFileResolver('strings'));
    $path = $resolver->resolve($file_name, array($locale_id));

    $this->_path_cache[$file_name][$locale_id] = $path;

    return $path;
  }
예제 #5
0
  public function validate($dataspace)
  {
    foreach($this->rules as $key => $rule)
    {
      resolveHandle($this->rules[$key]);

      $this->rules[$key]->setErrorList($this->_getErrorList());
      $this->rules[$key]->validate($dataspace);
      $this->is_valid = (bool)($this->is_valid & $this->rules[$key]->isValid());
    }
    return $this->is_valid;
  }
  function _fillTestGroup(&$group)
  {
    $test_cases =& $group->getTestCasesHandles();
    foreach(array_keys($test_cases) as $key)
    {
      resolveHandle($test_cases[$key]);

      if(is_a($test_cases[$key], 'LimbGroupTest'))
        $this->_fillTestGroup($test_cases[$key]);

      $group->addTestCase($test_cases[$key]);
    }
  }
예제 #7
0
function getIni($file_name, $use_cache = null)
{
  if (isset($GLOBALS['testing_ini'][$file_name]))
  {
    $resolved_file = VAR_DIR . $file_name;
    $use_cache = false;
  }
  else
  {
    resolveHandle($resolver =& getFileResolver('ini'));
    $resolved_file = $resolver->resolve($file_name);
  }

  return new Ini($resolved_file, $use_cache);
}
function instantiateSessionObject($class_name, &$arguments = array())
{
  if(	!isset($_SESSION['global_session_singleton_'. $class_name]) || 
      get_class($_SESSION['global_session_singleton_'. $class_name]) != $class_name)
  {
    $handle =& $arguments;
    array_unshift($handle, $class_name);

    resolveHandle($handle);

    $_SESSION['global_session_singleton_' . $class_name] = $handle;
  }
  else
    $handle = $_SESSION['global_session_singleton_' . $class_name];

  return $handle;
}
  protected function _processState($state_name)
  {
    if (!isset($this->states[$state_name]))
    {
      throw new LimbException('illegal state',
                            array('state_name' => $state_name));
    }

    $state_data = $this->states[$state_name];
    resolveHandle($state_data['command']);
    $result = $state_data['command']->perform();

    if (isset($state_data['transitions'][$result]))
      return $state_data['transitions'][$result];
    elseif(isset($state_data['transitions'][self :: BY_DEFAULT]))
      return $state_data['transitions'][self :: BY_DEFAULT];
    else
      return false;
  }
  function _displayBrowse($path, &$root_group, &$current_group)
  {
    if($root_group != $current_group)
      echo '<p><a href="' . $this->getBaseURL() . '?browse=' . $path . '/..">Back</a></p>';

    if (is_a($current_group, 'LimbGroupTest'))
      $group_tests = $current_group->getTestCasesHandles();
    else
      $group_tests = array();

    $buffer = "<br><a href='" . $this->getBaseURL() . "?perform={$path}&back=1'>Run all tests from this group</a>\n";

    $buffer .= "<p>Available test groups in '" . $current_group->getLabel() . "':</p>\n";

    if (sizeof($group_tests))
    {
      $buffer .= "<ul>";
      foreach ($group_tests as $index => $group_test)
      {
        resolveHandle($group_test);

        if(!is_a($group_test, 'LimbGroupTest'))
        {
          $buffer .= "<li><a href='" . $this->getBaseURL() . "?perform={$path}/{$index}'>P</a> " . $group_test->getLabel() . "</li>\n";
        }
        else
        {
          $buffer .= "<li><a href='" . $this->getBaseURL() . "?perform={$path}/{$index}'>P</a> <a href='" . $this->getBaseURL() . "?browse={$path}/{$index}'>B</a> " . $group_test->getLabel() . "</li>\n";
        }
      }
      $buffer .= "</ul>\n";
    }
    else
      $buffer .= "<p>No groups available.</p> \n";

    echo $buffer;

    echo Debug :: parseHtmlConsole();
  }
  static public function create($class_path)
  {
    $class_name = end(explode('/', $class_path));

    if(isset(self :: $datasources[$class_name]))
      return self :: $datasources[$class_name];

    if(!class_exists($class_name))
    {
      resolveHandle($resolver =& getFileResolver('datasource'));

      if(!$full_path = $resolver->resolve($class_path))
        return null;

      include_once($full_path);
    }

    $datasource = new $class_name();

    self :: $datasources[$class_name] = $datasource;

    return $datasource;
  }
 protected function _createJobObject($handle)
 {
   resolveHandle($handle);
   return $handle;
 }
 public function getView()
 {
   resolveHandle($this->view);
   return $this->view;
 }
/**
* Determines the full path to a source template file.
*/
function resolveTemplateSourceFileName($file)
{
  resolveHandle($resolver =& getFileResolver('template'));

  return $resolver->resolve($file);
}
 function testConstructor()
 {
   $handle = array('DeclaredInSameFile', 'construction_parameter');
   resolveHandle($handle);
   $this->assertIsA($handle, 'DeclaredInSameFile');
   $this->assertEqual($handle->test_var, 'construction_parameter');
 }